Re: [PATCH] fs/ntfs3: Use kernel ALIGN macros over driver specific

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 25, 2021 at 07:37:15AM +0300, Dan Carpenter wrote:
> On Tue, Aug 24, 2021 at 09:20:59PM +0300, Kari Argillander wrote:
> > Prefer built in ALIGN macros over special made ones. This can be
> > helpful for some static analyzing tools.
> > 
> 
> The patch is fine but the commit message is not clear that this fixes
> a runtime bug.

Is below better? Will send V2 if this is ok to you.


fs/ntfs3: Use kernel ALIGN macros over driver specific

The static checkers (Smatch) were complaining because QuadAlign() was
buggy.  If you try to align something higher than UINT_MAX it got
truncated to a u32.

Smatch warning was:
	fs/ntfs3/attrib.c:383 attr_set_size_res()
	warn: was expecting a 64 bit value instead of '~7'

So that this will not happen again we will change all these macros to
kernel made ones. This can also help some other static analyzing tools
to give us better warnings.

Patch was generated with Coccinelle script and after that some style
issue was hand fixed.

<insert coccinelle script >

Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Kari Argillander <kari.argillander@xxxxxxxxx>


> 
> The static checkers (Smatch) were complaining because QuadAlign() was
> buggy.  If you try to align something higher than UINT_MAX it got
> truncated to a u32.
> 
> regards,
> dan carpenter




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux