Re: [PATCH] iio: backend: fix uninitialized data in debugfs
Maxwell Doose <[email protected]>
| Newsgroups | org.kernel.vger.kernel-janitors,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAKqfh0FMsor4WnrdMcXrF4+G=m-Vu=nGq5ieDz8C=bUOvicT-g@mail.gmail.com> |
On Fri, Jun 5, 2026 at 3:28 AM Andy Shevchenko <[email protected]> wrote: > > On Fri, Jun 05, 2026 at 09:12:38AM +0300, Dan Carpenter wrote: > > On Thu, Jun 04, 2026 at 05:55:08PM +0300, Andy Shevchenko wrote: > > > On Thu, Jun 04, 2026 at 01:42:11PM +0300, Dan Carpenter wrote: > > > > On Thu, Jun 04, 2026 at 01:38:50PM +0300, Dan Carpenter wrote: > > > > > 168 ret = sscanf(buf, "%i %i", &back->cached_reg_addr, &val); > > > > > ^^^ > > > > > Uninitialized variable. > > > > > > > > s/variable/data/. > > > > > > With what I asked in the previous reply and what you explained there > > > (thanks, btw!) I still think your patches are not fully correct. They > > > will require to atomically write all or nothing. If we want support > > > partial writes we need to go with that differently (reset ppos when > > > we got enough or more than enough data). > > > > Requiring writes to syfs and debugfs be atomic is pretty normal and > > works well in practice. These are very small writes. > > Perhaps. In any case your patch will break existing partial writes, right? > I'm still considering that resetting ppos is the right thing to do. Just > need to find where the best place is to do that. > I'm certainly no expert on simple_write_to_buffer() but something in me tells me that writing in the middle of a buffer is a code smell. But you all seem much more informed in that regard so don't trust me :)