From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 713D53E834C for ; Tue, 9 Jun 2026 08:09:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780992557; cv=none; b=EbqrHOFddXW45SlxBYd+4msZKqW8R/YfR13d7bvPjzzwaWvYDvhh3EjePpFDdA+2MXgGjqUj8TE3gVBiW3Yvvx76WkrIcVnPjVMLKUUTPyz063oBnHpxCZC7uTfp/PuG5H8g08SUANuc/AuLZPHteLB/96zLghXO8l3J8VsZ/pA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780992557; c=relaxed/simple; bh=vi+VOT8rSuprhEiLqbw4rh2nm8VodjS4a3hs2w+jxc0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WpCOhIgtvUiRB8SVniXnkLC2saidwuUyyRKWuw7Cibo0hFqSq9/tyCOVfTpjwvOas9BuxMlVMnf5ie/Dr67NabLyfT94VOMi658X5ludfUurbFo7L9Ba2Jz/OiCck3wCvyFS+qJa2FPy28GA1O0C2P6qJx/rjJXF2chB4sgEjP4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IbCGkngm; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IbCGkngm" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-45eeea039ebso2709881f8f.1 for ; Tue, 09 Jun 2026 01:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780992555; x=1781597355; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=mNDXjDnKJx4rH6WjQAFNVVztRW9DfM4vW7rViQVW+to=; b=IbCGkngmJ8VJkTa0Ah5r2izsEYEoQB2VUylIXKcEj3PBMF9Ou9EOk3rCrRc5tcGf6K KSWx8Q4+IcZ0PHPQsMiHUUfyeepuRB6E8+xg9BdcindFHUPDSm0kaB3juOsF5F4ppD/Z HGaqsv7nM5pkermJ54UlwsDhEFFRog3QoHkuifRFH2S+45LL4aR8SuzOFPOoCV4O7KF9 MZHSs98EcO7X6NB4c2h5Q6nS3wh3dD2PXXZa2Qi6zJA6nBtShVu+D5MMkYndNGHfZpNr eSdMQqTMLyZAoo2bkdiEHV6LT1p1XgWV0SPuUiouroj1j23eqQ6eFbN8+PFuzn4aaTtj aZaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780992555; x=1781597355; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mNDXjDnKJx4rH6WjQAFNVVztRW9DfM4vW7rViQVW+to=; b=QFeisJGc3jrEOBRuF1T7Nl8N+T+zM+3/H3M8eMly4CMJyWc4dTg7rhLCIkMueve3ex UgpbCiVhi9NjkN8miNRBh5V3xBlqEI0PCglrZFQ0mFO6yByTabSTSYdbnTsQUspESQrx QqKwoRopH5i9nsx4L5ai5EzprnVkYV+g+ykTAg8bWvrRSSKDFXETj4Au/ALRflz0HMcW eSu6OoG6nC4tIvU6qcHaSPX2svtypvbCLl485yZ/uPSirN/mLjplC71Q+X1ntyz10u+p 0kIlO1v9LdQpRFVIdgcDZAF+JeIh8xDlL0EsHhuSMfOzr3dIQNvf5QnbLDdwstcX63yk 72Hg== X-Forwarded-Encrypted: i=1; AFNElJ9AswGcZARZoWM7TBWiT5B7DA0/RlXNv98KdqnRDuBkNMwpg2W3HDwO/vR0FtukMaAODbxE4mo7Q3AiZ2s=@vger.kernel.org X-Gm-Message-State: AOJu0Yy55GNCxhwL3NCq5cyY1n06bW64H+k3kSxwC1eHbKVtHUU+bduA c0Y1WkvHKoS+YEGhM4umT5ZMBfOEEr/Cr+7qnPACjewTqoUsMEx3l0Hd X-Gm-Gg: Acq92OHiDqAVTfZDUYxZNIRb2lH+ArrcnCMfscsDwdTokoN23h1/E8r2F1BoatYN3vx LkH7xlaSoqERvrr4+sswsPJNE9YZ6Su07QZmtNzHKqXFm5KQX95V8Ek4zGQDmh1dxgIUBmc1Vtp Lu92p/xxuClw2luZ/yt7XyPibs+evot1CSuSmus1eNWuYpmeTrZscVps5+D3ukotTUn3bztCDXb QeZbi3Xq+axmopmCuZRnIZzWUqoipTLkdaQIoCtxX99H2UO1omXQhiAL16syCgNw3dlGlAHkYWH bYaMKf7LNCxDIdnmDYxxmoLFa/AkgpZjqRITESjVQPAuBOZ0xt4zNrj4DVL1rJfezJ7Vol1Rm5y JakjPa3lq+JRmh7LywO7PK2rimtLtkx0LkU+/8piTx088MhcEjv9jaixtVFPSsTkFPvQmcP0eQS vFfaDLaEr2v87pWZUnWwqYAE4ezw== X-Received: by 2002:adf:e848:0:b0:460:cfc:eb24 with SMTP id ffacd0b85a97d-460304fec2bmr24364856f8f.22.1780992554596; Tue, 09 Jun 2026 01:09:14 -0700 (PDT) Received: from nsa ([148.63.225.166]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f351d69sm108188629f8f.29.2026.06.09.01.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 01:09:14 -0700 (PDT) Date: Tue, 9 Jun 2026 09:10:14 +0100 From: Nuno =?utf-8?B?U8Oh?= To: Maxwell Doose Cc: Andy Shevchenko , Dan Carpenter , Jonathan Cameron , Nuno Sa , Olivier Moysan , David Lechner , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] iio: backend: fix uninitialized data in debugfs Message-ID: References: <20260608165138.16b88dbc@linuxescape> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260608165138.16b88dbc@linuxescape> On Mon, Jun 08, 2026 at 04:51:38PM -0500, Maxwell Doose wrote: > On Mon, 08 Jun 2026 21:31:14 +0100 > Nuno Sá wrote: > > > On Fri, 2026-06-05 at 11:28 +0300, Andy Shevchenko 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 think anyone doing partial writes on a debugfs interface like this one is very > > unlikely but it is a fair point, yes. But can't we be more relaxed on debugfs? No > > userspace app should be relying on debugfs in order to work (though I know that > > actually happens). > > > > Anyways, this is one of those interesting edge cases and easy enough to get wrong. I > > guess we should either: > > > > 1. Improve simple_write_to_buffer() docs; > > 2. Or come up with a new simple_write_once_to_buffer() helper? > > > > When you say "simple_write_once_to_buffer()" do you mean a wrapper > around simple_write_to_buffer() that also checks if *ppos is 0 and > returns -EINVAL if *ppos isn't 0? If so I can start writing that > function. Though I guess we probably want to ask Jonathan about it > first since obviously he'll have his own opinions. Yeah basically not allowing partial writes. Partial writes are also very tricky to handle in terms of concurrency (assuming userspace can do whatever they want). But I would not rush into writing the helper without understanding how people feel about it (at least the ones in this thread). Might not be super beneficial. - Nuno Sá > > -- > best regards, > max