lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 27 May 2024 11:50:58 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>,
	Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
	ye xingchen <ye.xingchen@....com.cn>,
	Hans Verkuil <hverkuil-cisco@...all.nl>
Cc: oe-kbuild@...ts.linux.dev, Yasin Lee <yasin.lee.x@...look.com>,
	jic23@...nel.org, lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
	lars@...afoo.de, swboyd@...omium.org, nuno.a@...log.com,
	u.kleine-koenig@...gutronix.de, linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org, yasin.lee.x@...il.com
Subject: Re: [PATCH] iio:proximity:hx9031as: Add TYHX HX9031AS/HX9023S sensor
 driver

Mauro, Hans,

The debugfs code in drivers/media/common/siano/smsdvb-debugfs.c is
completely broken.  No one has tested it since Dec 2022.  Can we just
remove it?

On Mon, May 27, 2024 at 11:14:16AM +0300, Dan Carpenter wrote:
> On Sat, May 25, 2024 at 05:00:59PM +0300, Andy Shevchenko wrote:
> > On Thu, May 23, 2024 at 3:42 PM Dan Carpenter <dan.carpenter@...aro.org> wrote:
> > 
> > 
> > > 5e5a419c9407f6 Yasin Lee 2024-05-10  1110  static ssize_t hx9031as_raw_data_show(struct file *file, char __user *user_buf, size_t count, loff_t *ppos)
> > > 5e5a419c9407f6 Yasin Lee 2024-05-10  1111  {
> > > 5e5a419c9407f6 Yasin Lee 2024-05-10  1112       char buf[BUF_SIZE] = {0};
> > > 5e5a419c9407f6 Yasin Lee 2024-05-10  1113       char *p = buf;
> > > 5e5a419c9407f6 Yasin Lee 2024-05-10  1114       int ii = 0;
> > > 5e5a419c9407f6 Yasin Lee 2024-05-10  1115
> > > 5e5a419c9407f6 Yasin Lee 2024-05-10  1116       hx9031as_sample();
> > > 5e5a419c9407f6 Yasin Lee 2024-05-10  1117       for (ii = 0; ii < HX9031AS_CH_NUM; ii++) {
> > > 5e5a419c9407f6 Yasin Lee 2024-05-10 @1118               p += snprintf(p, PAGE_SIZE, "ch[%d]: DIFF=%-8d, RAW=%-8d, OFFSET=%-8d, BL=%-8d, LP=%-8d\n",
> > >                                                                          ^^^^^^^^^
> > 
> > 
> > > Also use scnprintf() instead of snprintf() unless you need to check the
> > > results.
> > 
> > This is incorrect advice. You should recommend sysfs_emit() /
> > sysfs_emit_at() in this kind of case.
> 
> No, this is not sysfs code.  It's debugfs.  The API is completely
> different.

I was going to say that if you find yourself calling sysfs_emit_at()
then you're already in trouble because sysfs is supposed to be one thing
per file.

But then I searched and we call it almost 1000 times.

The first caller I looked at was drivers/media/common/siano/smsdvb-debugfs.c
from commit 2f7d0c94396e ("media: siano: Convert to use sysfs_emit_at()
API") which changes debugfs code to use sysfs_emit().  And it so clearly
has never been tested because debug_data->stats_data does not point to
the start of a page.  sysfs_emit() will refuse to print anything unless
it's given a pointer to the start of a page.  Ugh...

regards,
dan carpenter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ