Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1654513
| From | Andy Shevchenko <andy.shevchenko@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 1/7] gpio: mockup: improve the debugfs input sanitization |
| Date | 2017-05-31 20:10 +0200 |
| Message-ID | <tNgee-8ge-11@gated-at.bofh.it> (permalink) |
| References | <tMLaq-54b-5@gated-at.bofh.it> <tMLaq-54b-15@gated-at.bofh.it> <tMUx3-2xi-17@gated-at.bofh.it> <tN9w6-3Ek-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, May 31, 2017 at 1:52 PM, Bartosz Golaszewski <brgl@bgdev.pl> wrote: > 2017-05-30 20:52 GMT+02:00 Andy Shevchenko <andy.shevchenko@gmail.com>: >> On Tue, May 30, 2017 at 11:58 AM, Bartosz Golaszewski <brgl@bgdev.pl> wrote: >>> + if (val != 0 && val != 1) >> >> Wouldn't be easier to have >> >> u8 rv; >> >> ret = kstrtu8_from_user(); >> if (ret >= 2) >> return ...; >> >> ? > > kstrtu8_from_user() doesn't return the converted value, so you won't > skip an if anyway Oh, yes. > and by using the int variant, we're avoiding a cast. > I'd prefer it this way frankly. Fair enough. (Though I would go with (val < 0 && val > 1) condition, of course it's matter of taste) -- With Best Regards, Andy Shevchenko
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 1/7] gpio: mockup: improve the debugfs input sanitization Bartosz Golaszewski <brgl@bgdev.pl> - 2017-05-30 11:00 +0200
Re: [PATCH v2 1/7] gpio: mockup: improve the debugfs input sanitization Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-30 21:00 +0200
Re: [PATCH v2 1/7] gpio: mockup: improve the debugfs input sanitization Bartosz Golaszewski <brgl@bgdev.pl> - 2017-05-31 13:00 +0200
Re: [PATCH v2 1/7] gpio: mockup: improve the debugfs input sanitization Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-31 20:10 +0200
csiph-web