From owner-svn-src-all@FreeBSD.ORG Sun Oct 16 17:21:16 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 813B11065673; Sun, 16 Oct 2011 17:21:16 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 2925D8FC0A; Sun, 16 Oct 2011 17:21:15 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 8580F896; Sun, 16 Oct 2011 19:21:13 +0200 (CEST) Date: Sun, 16 Oct 2011 19:20:28 +0200 From: Pawel Jakub Dawidek To: Christian Brueffer Message-ID: <20111016172028.GB1832@garage.freebsd.pl> References: <201110151557.p9FFvuuc020536@svn.freebsd.org> <20111016154611.GA1832@garage.freebsd.pl> <4E9B0CEE.7000809@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1UWUbFP1cBYEclgG" Content-Disposition: inline In-Reply-To: <4E9B0CEE.7000809@FreeBSD.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226398 - head/sys/dev/iicbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 16 Oct 2011 17:21:16 -0000 --1UWUbFP1cBYEclgG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 16, 2011 at 06:57:18PM +0200, Christian Brueffer wrote: > > I think that better fix is to move usrbufs allocation after copyin(), as > > usrbufs is not used there. > > >=20 > Agreed, how about the attached patch? Looks good. > Index: iic.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- iic.c (revision 226398) > +++ iic.c (working copy) > @@ -346,13 +346,11 @@ > =20 > case I2CRDWR: > buf =3D malloc(sizeof(*d->msgs) * d->nmsgs, M_TEMP, M_WAITOK); > - usrbufs =3D malloc(sizeof(void *) * d->nmsgs, M_TEMP, M_ZERO | M_WAITO= K); > error =3D copyin(d->msgs, buf, sizeof(*d->msgs) * d->nmsgs); > - if (error) { > - free(usrbufs, M_TEMP); > + if (error) > break; > - } > /* Alloc kernel buffers for userland data, copyin write data */ > + usrbufs =3D malloc(sizeof(void *) * d->nmsgs, M_TEMP, M_ZERO | M_WAITO= K); > for (i =3D 0; i < d->nmsgs; i++) { > m =3D &((struct iic_msg *)buf)[i]; > usrbufs[i] =3D m->buf; --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --1UWUbFP1cBYEclgG Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk6bElwACgkQForvXbEpPzQRBQCgmeXbugKIMbWQUNpiMxc/C/WK c+0AnjflxBSwg7ugzEnRGK/lfcc/CEei =dpbp -----END PGP SIGNATURE----- --1UWUbFP1cBYEclgG--