From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (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 EDB6837205F for ; Wed, 10 Jun 2026 07:09:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781075342; cv=none; b=UHzfhC6PjGIkYEvSnlxsOPkaOxWjpuoYXKo4E7pDtF6Vm78Lj9RZYBwdHpAbnBxhmlFmEIp/u1UVVQ99wvmF/H3ub+jWzRn60xxkEz9FqaLnnybtwmmxxxGvar7y5Po6tsrpUYzEBDKeFlyWHe6iZpwTcMZANTIN9KGJtuJYioA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781075342; c=relaxed/simple; bh=4QaEaRpHh5ob/pH1ZPfGUqviHLTt9W6IoZliqWkOIDw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XKOa9aJA1rvR7lDHQYuGZR9paJ+rAklEOH8kUDwkQKHVj1IDvKqT1+AkxZ3TaVsO5GL2P6X3m4yybEajEJ2YDy7//b73iRv0bIhWlIPkguTlcxvgTR24FdNlaWgDa1K9wWGR1EI91IVKZ3XMzPhAtk+u0DQYIuEEzOf4iB0sPto= 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=X9f5l8BF; arc=none smtp.client-ip=209.85.222.169 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="X9f5l8BF" Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-9158629a220so710888385a.1 for ; Wed, 10 Jun 2026 00:09:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781075340; x=1781680140; 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=YJRNM1QqidReowMfIbP+H7r4w0/cgZrB3E4XBHg5YIo=; b=X9f5l8BF31uXJkQL+uHdEeCELUOez6OuXO0fJbgR4YNoRnkYtIO5ou/iJrURZnhx3Z x1PEsMM6ZnrWmT84b1huW/FskmObjsCycvjO2k7toXaVTNQVJqz5e5eODNUVc9djtYUw H8kUgvgCg8a5ScsnB5yraP+amdoyfAzNtG3YYrZsWCZ/P43FFTrFgVLgfSC426Ovau56 HrCeL7x+KqGVabBbpWmtPZ7nSFms2ofj5l86U9DKZmOVtzgtLXH7y3gvH0F5wToVuOHV SPvotJRK5DLfq0hnxQ5FUeXwJUx23foHFN+CAZnPJ5D2rIsvrHXveLTsqA8LNXQyPYb/ ZmLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781075340; x=1781680140; 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=YJRNM1QqidReowMfIbP+H7r4w0/cgZrB3E4XBHg5YIo=; b=DcAgVtCL9xg5etxMI570tgPPwHkRIoKZTzgl+gRByiGns3dRv5wZu+BVM15JMOTqAg Mez7e/M+6Ftx1eTwWB2gR3qGmKPb6Tbi/JXzlY9lWZt9BHwvuIqGLZla7XQ/PRB84v93 A3ULKkYYaueggozPXedYd5afiij5mLOYLmltnb09hEw+s3pACRq5x7UK5zMLiIJgJYaW P+bK53q7ItyhTIGIGQbpnawJ28OTK0H8ry+e9Mj4rT8c1srMdVv+hwcbecnj992HtpD4 97ECvC/Nw94JiVgvtYavqJ+3ad0PjQ7UuR5cIVqd70MFB4U7ESrjWF7KdrYGLcDYs+Ud 0EFw== X-Forwarded-Encrypted: i=1; AFNElJ8uXyOnP/3gtrdJjgXiAe/3/bLeOtNzYAdGg/cbZxm4WdMQ1BmOzSvSAAg8YzlA7GNbP+kMErM8wBJ6pbw=@vger.kernel.org X-Gm-Message-State: AOJu0YxxEDzFwO+9HkOO1LXOsAo+oFyndvb0tUysoXpvY7wtRaNOxCn3 mPcdnXHENTEHui9BEKOQIMvHC54S3Ir+SMG1dV6tBOM+Ef9JSI87E8aD X-Gm-Gg: Acq92OFAOEmzprzgeWq0+mCYlnTPoj1OV9QLoJH6hjnTVgTtlzPi5cZUbuyW0Bt0Agr plDcAzfSp8rRG9vhSrzHXVXj8k8PkrCBNbEUiqMdGwalDjcVb+5rzi659M7yVXAhd+eT7hRo3vh y7MU7WdFoQz9tqJBZHFgPAYteOMjhP0GxPEZKxaxZV94npRVA6ktcVAUbAzMiuCw2rcVHoppNdO 2FOYEpnwtlZNASE678k5koYUHMm4yXyc5dBABaplJrba8oLNJFr7mBmLZbgfcoSNhvCa8ichu+Q LhAq9Jpgc+IhjEcNTh/SGYlaN7tpGMS5mZ1k6ytCVocFbmvKze0I+L7OvX8TU7Xv/pB5hnmAIxK tcaAvU/eRdSkEZn8GkBytXs13dRRCaU6ma7psRn9XNZRSF7KltRi5e+O/h8f9UscJt0rqH6avK/ qPHGbpeGFz+bz4DtFNk82WnHMy7+E= X-Received: by 2002:a05:620a:468f:b0:915:9fba:8795 with SMTP id af79cd13be357-915e822c8c9mr960670485a.1.1781075340029; Wed, 10 Jun 2026 00:09:00 -0700 (PDT) Received: from localhost ([149.40.50.222]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9158a21f871sm2377796085a.12.2026.06.10.00.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2026 00:08:59 -0700 (PDT) Date: Tue, 9 Jun 2026 09:21:05 +0300 From: Dan Carpenter To: Nuno =?iso-8859-1?Q?S=E1?= Cc: Andy Shevchenko , Jonathan Cameron , Maxwell Doose , 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: 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Jun 08, 2026 at 09:31:14PM +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? The right function is copy_from_user(). The point of simple_write_to_buffer() is to support partial writes and in many cases that just doesn't make sense. regards, dan carpenter