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: <Z-f4irfx5Jtz-rfk@debian-BULLSEYE-live-builder-AMD64>
Date: Sat, 29 Mar 2025 10:41:30 -0300
From: Marcelo Schmitt <marcelo.schmitt1@...il.com>
To: Siddharth Menon <simeddon@...il.com>
Cc: linux-iio@...r.kernel.org, lars@...afoo.de,
	Michael.Hennerich@...log.com, jic23@...nel.org,
	gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
	linux-staging@...ts.linux.dev
Subject: Re: [PATCH v3] iio: frequency: ad9832: Use FIELD_PREP macro to set
 bit fields

Hi Siddharth,

On 03/25, Siddharth Menon wrote:
> On Sat, 22 Mar 2025 at 18:50, Marcelo Schmitt
> <marcelo.schmitt1@...il.com> wrote:
> >
> > On 03/19, Siddharth Menon wrote:
> > > Refactor code to use the FIELD_PREP macro for setting bit fields
> > > instead of manual bit manipulation.
> >
... 
> I shall send in another patch addressing this.

My understanding of Jonathan's reply to this patch is that it would actually be
ok to do all MASK/FIELD_PREP/FIELD_GET cleanup in a single patch.

> 
> > > -             st->data = cpu_to_be16((AD9832_CMD_SYNCSELSRC << CMD_SHIFT) |
> > > +             st->data = cpu_to_be16(FIELD_PREP(AD9832_CMD_MSK, AD9832_CMD_SYNCSELSRC) |
> > >                                       st->ctrl_ss);
> > Not sure about this assignment with mix of FIELD_PREP and non-FIELD_PREP value.
> > Maybe have
> >                                        FIELD_PREP(AD9832_DAT_MSK, st->ctrl_ss)); ?
> 
> From what I understood, I don't think that would work out. AD9832_SELSRC
> = BIT(12) but AD9832_DAT_MSK only covers bits 7 through 0 GENMASK(7, 0).
>  It could exceed the maximum value allowed by the mask.

Ah yes, that's correct. I didn't look very carefully at the assignment
surroundings when replying. Sure, it would use the BIT(12) mask. So, something like
FIELD_PREP(AD9832_SELSRC, st->ctrl_ss)

> 
> Thanks,
> Siddharth Menon

Regards,
Marcelo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ