[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0d5fda5b25b8467c860d625116dac1d2@AcuMS.aculab.com>
Date: Sat, 31 Dec 2022 13:23:14 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Herbert Xu' <herbert@...dor.apana.org.au>
CC: 'Roberto Sassu' <roberto.sassu@...weicloud.com>,
"dhowells@...hat.com" <dhowells@...hat.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"zohar@...ux.ibm.com" <zohar@...ux.ibm.com>,
"dmitry.kasatkin@...il.com" <dmitry.kasatkin@...il.com>,
"paul@...l-moore.com" <paul@...l-moore.com>,
"jmorris@...ei.org" <jmorris@...ei.org>,
"serge@...lyn.com" <serge@...lyn.com>,
"ebiggers@...nel.org" <ebiggers@...nel.org>,
"linux-integrity@...r.kernel.org" <linux-integrity@...r.kernel.org>,
"linux-security-module@...r.kernel.org"
<linux-security-module@...r.kernel.org>,
"keyrings@...r.kernel.org" <keyrings@...r.kernel.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH v5 1/2] lib/mpi: Fix buffer overrun when SG is too long
From: Herbert Xu
> Sent: 30 December 2022 15:40
>
> On Fri, Dec 30, 2022 at 01:35:07PM +0000, David Laight wrote:
> >
> > miter.length is size_t (unsigned long on 64bit) and nbytes unsigned int.
>
> miter.length is bounded by sg->length which is unsigned int.
I did say 'technically' :-)
Should there be a sg_miter_stop() before the return at the bottom?
Care seems to have been taken to add one before an earlier error return.
(The logic in that function is very strange...)
Indeed other parts of the file are equally strange.
The big multi-line if-else in twocompl() is just:
p[i] = (p[1] ^ 0xff) + 1;
or even:
p[i] = -p[i];
That function could also return the 'zero status' to correct
for -0 (rather than the extra check earlier in the caller).
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists