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: <aN_jOrYnPMWtoR8d@ada.csh.rit.edu>
Date: Fri, 3 Oct 2025 10:52:42 -0400
From: Mary Strodl <mstrodl@....rit.edu>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: linux-kernel@...r.kernel.org, tzungbi@...nel.org,
	linus.walleij@...aro.org, brgl@...ev.pl, linux-gpio@...r.kernel.org
Subject: Re: [PATCH v3 3/4] gpio: mpsse: add quirk support

Hey Dan,

On Thu, Oct 02, 2025 at 11:34:13PM +0300, Dan Carpenter wrote:
> On Thu, Oct 02, 2025 at 02:11:35PM -0400, Mary Strodl wrote:
> > * dir_in/out are bitmask of lines that can go in/out. 0 means
> >   compatible, 1 means incompatible. This is convenient, because it means
> >   if the struct is zeroed out, it supports all pins.
> 
> What?  No, please make 1 be supported and 0 be not supported.  This
> really weirded me out when I read the code.  If it were just 1 for
> true and 0 for false a lot of comments regarding dir_in/out could be
> removed because the code would be straight forward.
> 
> You can easily set everything to 1 by assigning -1 or using memset().
Okay. I was thinking leaving out the fields altogether would be most convenient.

> > +static int mpsse_ensure_supported(struct gpio_chip *chip,
> > +				  unsigned long *mask, int direction)
> 
> Just pass mask not a pointer to mask.  It would be different if
> you were going to allow more than 32 bits to be set, then we would
> need to pass a pointer and use set_bit() etc...
The reason is because of set/get_multiple. I can deref in there instead though.

> > +		dev_err(&priv->udev->dev,
> > +			"mpsse: GPIO %d doesn't support %s\n",
> > +			(int)find_first_bit(&unsupported, sizeof(unsupported) * 8),
> 
> Use %lu instead of %d and get rid of the unnecessary cast.
Good catch. This was a fix for m68k builds that I forgot to remove:
https://lore.kernel.org/linux-gpio/CAMuHMdVpdk5JaqXf6LkSWQvZ7FnfyLdMWOJX+7n0=PZ-udH-WA@mail.gmail.com/

Thanks for taking a look!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ