Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1655201
| From | Jean Delvare <jdelvare@suse.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] firmware: dmi: Check DMI structure length |
| Date | 2017-06-01 16:50 +0200 |
| Message-ID | <tNzAd-3MT-1@gated-at.bofh.it> (permalink) |
| References | <tNy1s-2YH-17@gated-at.bofh.it> <tNyb9-32h-37@gated-at.bofh.it> |
| Organization | SUSE Linux |
Hi Andy, Thanks for the review. On Thu, 1 Jun 2017 16:16:05 +0300, Andy Shevchenko wrote: > On Thu, Jun 1, 2017 at 4:08 PM, Jean Delvare <jdelvare@suse.de> wrote: > > Before accessing DMI data to record it for later, we should ensure > > that the DMI structures are large enough to contain the data in > > question. > > > - const u8 *d = (u8 *) dm + index; > > + const u8 *d; > > > + d = (u8 *) dm + index; > > I think you may leave this as is and make it compiler's burden to optimize. Is there any benefit except making the patch smaller? > > - const u8 *d = (u8 *) dm + index; > > + const u8 *d; > > > + d = (u8 *) dm + index; > > Ditto. > > > - int i, count = *(u8 *)(dm + 1); > > + int i, count; > > > + count = *(u8 *)(dm + 1); > > Ditto. I would expect a static code analyzer to complain about at least the last one. Dereferencing a pointer before checking its validity is bad. I'm not a big fan of counting of compiler optimizations to make the code right. -- Jean Delvare SUSE L3 Support
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] firmware: dmi: Check DMI structure length Jean Delvare <jdelvare@suse.de> - 2017-06-01 15:10 +0200
Re: [PATCH] firmware: dmi: Check DMI structure length Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-01 15:20 +0200
Re: [PATCH] firmware: dmi: Check DMI structure length Jean Delvare <jdelvare@suse.de> - 2017-06-01 16:50 +0200
Re: [PATCH] firmware: dmi: Check DMI structure length Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-01 18:10 +0200
Re: [PATCH] firmware: dmi: Check DMI structure length Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-02 20:50 +0200
Re: [PATCH] firmware: dmi: Check DMI structure length Jean Delvare <jdelvare@suse.de> - 2017-06-03 23:20 +0200
Re: [PATCH] firmware: dmi: Check DMI structure length Jean Delvare <jdelvare@suse.de> - 2017-06-02 20:50 +0200
Re: [PATCH] firmware: dmi: Check DMI structure length Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-06-01 16:10 +0200
csiph-web