From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (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 0BE4839E197 for ; Mon, 8 Jun 2026 21:51:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780955503; cv=none; b=OQmTTGhdR0Ftnx4ePjypCUKh7pwq2pszvF0DVdYCBs55zYstSVnEZzgOKPZvX8yYZzJLjRnQVQ5qGWrXzlrqeq67/TNiY9IK8USEUBVOXnsE27oaSMdmK1EabXsGh9eegMdAx6CpTVHTVVwnlDCDlg7EXJcFziQI442BZzMNz+s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780955503; c=relaxed/simple; bh=xPoeKvwRcR6Eki/nGosErpDBtUaK/l+m2ggZ/c5Hd0k=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gup+bH3+gFBu6VaLwSB3rNMtfjrLjlYxXAarBehgZFVdo1YziTadMCVDPgHQVhBVlqh6yFL1f9aUzoap9aHWNevlHAkEoTmS5GswzwoJYNZwDktnL+znM2kyVIcgX1nJbTFNPijMlYdlNa+y+sO6GsB1mghrjrEZc8qoKrFp7EU= 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=ByBhrDnz; arc=none smtp.client-ip=209.85.210.54 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="ByBhrDnz" Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-7e6d991991dso4156865a34.3 for ; Mon, 08 Jun 2026 14:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780955501; x=1781560301; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=xPoeKvwRcR6Eki/nGosErpDBtUaK/l+m2ggZ/c5Hd0k=; b=ByBhrDnziytFU9kj75nniIPUFI22bHGiz9mlRKzIhSLcO2YR5nhVBbxnb3pFzPCdKo 0EQeD3ctBpE4ZoP4dx+XiH9Y/F7r2iF9HeOsbVfc8jAvou8VAQoSF0IrFB+Gyh0ZMKJk 8yPXVcYDTmxqZeVVZYAx5KJ3/cOQVwaWGhuaL9uOuU+40GGrxlE23o81i3se6rYEX54w SvIX3yCpSl3Cr0EPAbp96sYphqnb7latbkCMHZwuCNsUY/nehqmM14stAfavsQ41JSoB ILNWfpyYzL2NtKr8cd/rWbueGnirvff1TMPV7xvPttbcOS2DzX29GM3XqvSGuyINP36+ C54A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780955501; x=1781560301; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xPoeKvwRcR6Eki/nGosErpDBtUaK/l+m2ggZ/c5Hd0k=; b=FMN4tFcg4eJWkiLDaEtrncvraTUV+/Y78WUQthgJ5WJyNFOnM81Mz/XIk+ja03Q9aq VkFUSgVIcw0MeRyOC0eVx4T6h8COfFXEIVxvUucqF0uxvYBSrWPyB9MJlnR7ATNzO4tK 6V3H3aankUT9hVVLAQ/MU2GsVpXrYUr9j/6RdHbH4EuyjuNr+4dcIKT4B6LIa32HY4sR KLTteRj1e3dRwR2SNR7rZLDwzQkWiSSVstrMPA3Zv0EWwX33dJVJ0k55J/ABKdCKrg0j l21aKug665Q9Yh0/QLeQtzPsEXmNBCE51UHV5IwFxRXKilpO5Z3BJrDWlItTgrG2ZaW4 EXhQ== X-Forwarded-Encrypted: i=1; AFNElJ9vhoM8c7HHOkVuzAWt8aH4Sa71EUIlDQNUx+hrlxfimumDdL6OKuxXIo5MKxdLaFDb/mx4YlsmAC4zjjI=@vger.kernel.org X-Gm-Message-State: AOJu0YyffPEOhW10Xmk9bn42wrGOHs3XRoYGGAK7lQb/8jGALpoXwWVG nTuz2Tg24MssQG5GWe9RyOZTc62wDCkgbg7y6P/7D46NVZNneaH6gwhM X-Gm-Gg: Acq92OFkl9V8e+RSfxhoFxpOSStBySmJ+pqacLEumCP+6HVYdQVot85dIjcniDW3pdu DS3goyTvoVaNwo49AJwEXQHo2TgcnJ4ohNd9vfcUQid8kM1wGBTL8qsvblLymcoFRW/sbEW1/Lz JWdyJ1rPsIceaXqZpLTx7EooBMRcfqWMSQvCJqiOZSKDNw2negBYFHQ7KAXYHrLR0ASlxU8kKNw MEpmt2fJwhI1c9/5G581BAxVZebT8Bv95WzBVBvgn1un+rEsEKYa6yGu4uWlFIzjX8sKJIhNTBs ERyj3XXhGhJbOqUFsLcqU6M/DEU6gtcp24auX41bSdJcJ/KTLnPA6mpeyxxH8afHvrc+Ixv2MKH KtsGD+6+cskECAhMBTvl+G/7dlcoMPjWQG6nMWq47LW3/+ESeYToksZQ/s5LYliU83CxeacibK2 a3jb4Bb80b16BtxBFum2Fl5iDy9ZjG7qSSWSxftVL4RXafq35s9vtjcqhyq8GsKWY= X-Received: by 2002:a05:6830:640b:b0:7dc:d0e3:5bc1 with SMTP id 46e09a7af769-7e70c772c1bmr10801726a34.13.1780955500991; Mon, 08 Jun 2026 14:51:40 -0700 (PDT) Received: from linuxescape (23-88-128-2.fttp.usinternet.com. [23.88.128.2]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e6e7965006sm13343504a34.23.2026.06.08.14.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 14:51:40 -0700 (PDT) Date: Mon, 8 Jun 2026 16:51:38 -0500 From: Maxwell Doose To: Nuno =?UTF-8?B?U8Oh?= 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: <20260608165138.16b88dbc@linuxescape> In-Reply-To: References: <20260526191946.409160c8@jic23-huawei> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu) 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-Transfer-Encoding: quoted-printable On Mon, 08 Jun 2026 21:31:14 +0100 Nuno S=C3=A1 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: =20 > > > On Thu, Jun 04, 2026 at 05:55:08PM +0300, Andy Shevchenko wrote: =20 > > > > On Thu, Jun 04, 2026 at 01:42:11PM +0300, Dan Carpenter wrote: =20 > > > > > On Thu, Jun 04, 2026 at 01:38:50PM +0300, Dan Carpenter wrote: =20 > > > > > > =C2=A0=C2=A0 168=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 ret =3D sscanf(buf, "%i %i", &back->cached_reg_addr, &val); > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^^^ > > > > > > Uninitialized variable. =20 > > > > >=20 > > > > > s/variable/data/. =20 > > > >=20 > > > > With what I asked in the previous reply and what you explained there > > > > (thanks, btw!) I still think your patches are not fully correct. Th= ey > > > > 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). =20 > > >=20 > > > Requiring writes to syfs and debugfs be atomic is pretty normal and > > > works well in practice.=C2=A0 These are very small writes. =20 > >=20 > > Perhaps. In any case your patch will break existing partial writes, rig= ht? > > 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. =20 >=20 > 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 deb= ugfs? No > userspace app should be relying on debugfs in order to work (though I kno= w that > actually happens). >=20 > Anyways, this is one of those interesting edge cases and easy enough to g= et wrong. I > guess we should either: >=20 > 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. --=20 best regards, max