From owner-svn-src-all@freebsd.org Fri May 20 03:50:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA6FDB43E66; Fri, 20 May 2016 03:50:25 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp003.me.com (mr11p00im-asmtp003.me.com [17.110.69.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0F1E1D71; Fri, 20 May 2016 03:50:25 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp003.me.com by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.36.0 64bit (built Sep 8 2015)) id <0O7G00K00HTDFX00@mr11p00im-asmtp003.me.com>; Fri, 20 May 2016 03:50:19 +0000 (GMT) Received: from [192.168.1.4] (c-67-169-142-6.hsd1.ca.comcast.net [67.169.142.6]) by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.36.0 64bit (built Sep 8 2015)) with ESMTPSA id <0O7G00D1RINUMR00@mr11p00im-asmtp003.me.com>; Fri, 20 May 2016 03:50:19 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-05-19_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1605200047 User-Agent: Microsoft-MacOutlook/f.16.0.160506 Date: Thu, 19 May 2016 20:50:21 -0700 Subject: Re: svn commit: r300258 - head/sys/dev/iicbus From: Ravi Pokala Sender: "Pokala, Ravi" To: "Jason A. Harmening" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <371B94E2-E906-4F9C-9A9B-A9D35CD93D21@panasas.com> Thread-topic: svn commit: r300258 - head/sys/dev/iicbus References: <201605200303.u4K334pG019632@repo.freebsd.org> In-reply-to: <201605200303.u4K334pG019632@repo.freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=4d515a; t=1463716219; bh=5VCitGwoavPq0U7YqVUF628wCNRtn/Ez1+UAuRE9PlM=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=FACStwcd6r/LMWlmY9c3a/jjIkORd4yDdMeEG9cxwY65rdMCmM/KQRziYQY3IMILh +TeTZxqKaIsZJWYYk1GXzoKBPBj9ylvRRX2/Zi3jLU7q/Wg9tj4lQSHsHWL4r/O6wH dxxu6vzt3Ear/ci39q814HkN12IG/r0d9+zISnCpZWpIgRo5XjnmC6s9vO6bbTp9Oe diAVIxWYhCnsKCz2bF2gIzHL/ohUsyYgSxNdSKd94KYr57p8iwn30v5VVpE/X+nflQ VWP0IS2qoyX7HThBVwN/EHao6MAE+RrqMwfiIAe6As/BZ3kOK3yeUb4Hlczcyi+NM5 SGIw540hVYlaA== X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2016 03:50:25 -0000 -----Original Message----- From: on behalf of "Jason A. Harmening" = Date: 2016-05-19, Thursday at 20:03 To: , , Subject: svn commit: r300258 - head/sys/dev/iicbus >Author: jah >Date: Fri May 20 03:03:04 2016 >New Revision: 300258 >URL: https://svnweb.freebsd.org/changeset/base/300258 > >Log: > iic_rdwr_data->nmsgs is uint32_t, so limit the allowable number of messa= ges to prevent memory exhaustion and short allocations on 32-bit systems. Si= nce iicrdwr is intended to be a workalike of a Linux i2c-dev call, use the s= ame limit of 42 that Linux uses. > =20 > Also check the return value of copyin(9) to prevent unnecessary allocati= on in the failure case. > =20 > ... > =20 > error =3D copyin(d->msgs, buf, sizeof(*d->msgs) * d->nmsgs); >+ if (error !=3D 0) { >+ free(buf, M_IIC); >+ return (error); >+ } >=20 Hi Jason, If I=E2=80=99m reading that right, it=E2=80=99s not preventing any allocations, but it = is preventing a leak. Is that correct? Thanks, Ravi (rpokala@)