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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANZih_SWg03U1jOn63++A=+_9GkzFhtK7S563hdb2m=tk5SK0A@mail.gmail.com>
Date: Sat, 5 Jul 2025 00:45:05 -0300
From: Andrew Ijano <andrew.ijano@...il.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: andrew.lopes@...mni.usp.br, gustavobastos@....br, dlechner@...libre.com, 
	nuno.sa@...log.com, andy@...nel.org, jstephan@...libre.com, 
	linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 4/4] iio: accel: sca3000: use sysfs_emit_at() instead
 of sprintf()

On Sat, Jun 21, 2025 at 2:58 PM Jonathan Cameron <jic23@...nel.org> wrote:
> > @@ -423,16 +423,16 @@ sca3000_show_available_3db_freqs(struct device *dev,
> >  {
> >       struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> >       struct sca3000_state *st = iio_priv(indio_dev);
> > -     int len;
> > +     unsigned int len = 0;
>
> No need to initialize as set on the next line

That makes sense! I´ll change that.

>
> >
> > -     len = sprintf(buf, "%d", st->info->measurement_mode_3db_freq);
> > +     len = sysfs_emit_at(buf, len, "%d", st->info->measurement_mode_3db_freq);
>
> sysfs_emit() when you know you are at the start.
>
Ok! Thanks.

>
> >       if (st->info->option_mode_1)
> > -             len += sprintf(buf + len, " %d",
> > +             len += sysfs_emit_at(buf, len, " %d",
> >                              st->info->option_mode_1_3db_freq);
> Fix alignment.
>
> >       if (st->info->option_mode_2)
> > -             len += sprintf(buf + len, " %d",
> > +             len += sysfs_emit_at(buf, len, " %d",
> >                              st->info->option_mode_2_3db_freq);
>
> same here.

Actually, both cases are aligned. I checked the code and they have the
same number of tabs, and in this email they have the same number of
spaces.
However, since I'm not reading this diff with a monospaced font, for
me it appears to be different but this is caused by the difference in
size of "-" and "+".
Maybe this is why it appears to be different for you too?

Thanks,
Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ