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]
Date:   Mon, 8 Apr 2019 13:09:47 +0300
From:   Andy Shevchenko <andriy.shevchenko@...el.com>
To:     Mika Westerberg <mika.westerberg@...ux.intel.com>
Cc:     Chris Chiu <chiu@...lessm.com>, heikki.krogerus@...ux.intel.com,
        drake@...lessm.com, linus.walleij@...aro.org,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux@...lessm.com
Subject: Re: [PATCH] pinctrl:intel: Retain HOSTSW_OWN for requested gpio pin

On Mon, Apr 08, 2019 at 10:41:06AM +0300, Mika Westerberg wrote:
> On Mon, Apr 08, 2019 at 12:21:03PM +0800, Chris Chiu wrote:
> > +static void

static u32

(see below why)

> > +intel_gpio_update_pad_mode(void __iomem *hostown, u32 mask, u32 value)
> > +{
> > +	u32 curr = readl(hostown);
> > +	u32 updated = (curr & ~mask) | (value & mask);
> 
> I think here we should first complain if the expected ownership is not
> correct. Warning or info level probably enough.

It is easy to achieve, something like

if ((value ^ saved) & requeted)
	dev_warn(...);

See also below.

(I had mentioned this earlier)

> > +	return writel(updated, hostown);

writel() is a void function, this is wrong. We need to return curr instead to
make above working to issue a warning message.

> Also if the pin is not requested and not changed we should not touch the
> register.

I don't think it brings any value here, if mask is 0 we will write back the
same value we read.

> Otherwise this looks good to me.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ