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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 25 Apr 2013 09:13:38 +0100
From:	Lee Jones <lee.jones@...aro.org>
To:	Rabin Vincent <rabin@....in>
Cc:	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	arnd@...db.de, linus.walleij@...ricsson.com,
	Vinod Koul <vinod.koul@...el.com>, Dan Williams <djbw@...com>,
	Per Forlin <per.forlin@...ricsson.com>
Subject: Re: [PATCH 03/32 v3] dmaengine: ste_dma40: Use the BIT macro to
 replace ugly '(1 << x)'s

On Wed, 24 Apr 2013, Rabin Vincent wrote:

> 2013/4/24 Lee Jones <lee.jones@...aro.org>:
> > The aim is to make the code that little more readable.
> >
> > Acked-by: Vinod Koul <vnod.koul@...el.com>
> > Acked-by: Arnd Bergmann <arnd@...db.de>
> > Signed-off-by: Lee Jones <lee.jones@...aro.org>
> 
> Please pay closer attention to the semantics of each usage instead of
> just replacing all x left shifts of 1 by BIT(x) for "readability".
> 
> >         if (seg_max > STEDMA40_MAX_SEG_SIZE)
> > -               seg_max -= (1 << max_w);
> > +               seg_max -= BIT(max_w);
> >
> > -       if (!IS_ALIGNED(size, 1 << max_w))
> > +       if (!IS_ALIGNED(size, BIT(max_w)))
> >                 return -EINVAL;
> 
> Here and in all other places where the values are from cfg->data_width,
> the semantic purpose of the shift is not for setting a particular bit
> but instead for converting the data_width field into the data width
> value in bytes.  You should not change these usages to BIT().
> 
> It would be instead better to just make the cfg->data_width as the
> number of bytes and convert them to the appropriate hardware field
> values when the descriptors are constructed.  That of course should be
> in another patch.

I'll do that. Thanks for the pointer.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ