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] [day] [month] [year] [list]
Message-ID: <20250706104159.59e525ee@jic23-huawei>
Date: Sun, 6 Jul 2025 10:41:59 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Andrew Ijano <andrew.ijano@...il.com>
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, 5 Jul 2025 00:45:05 -0300
Andrew Ijano <andrew.ijano@...il.com> wrote:

> 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?
Key as in earlier reply is parameters that need to go on an additional line
are not aligned as particular number of tabs, they are aligned to under
the parameters on the first line.

The only normal reason to break with that rule is on particularly long
lines.

Jonathan

> 
> Thanks,
> Andrew


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ