Re: [bug report] [PATCH] sys_sync_file_range()

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

 



On Wed, 14 Mar 2018 22:36:21 +0300 Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:

> Hello Andrew Morton,
> 
> The patch f79e2abb9bd4: "[PATCH] sys_sync_file_range()" from Mar 31,
> 2006, leads to the following static checker warning:
> 
> 	fs/sync.c:298 ksys_sync_file_range()
> 	warn: signed overflow undefined. 'offset + nbytes < offset'
> 
> fs/sync.c
>    279  int ksys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
>    280                           unsigned int flags)
>    281  {
>    282          int ret;
>    283          struct fd f;
>    284          struct address_space *mapping;
>    285          loff_t endbyte;                 /* inclusive */
>    286          umode_t i_mode;
>    287  
>    288          ret = -EINVAL;
>    289          if (flags & ~VALID_FLAGS)
>    290                  goto out;
>    291  
>    292          endbyte = offset + nbytes;
>    293  
>    294          if ((s64)offset < 0)
>    295                  goto out;
>    296          if ((s64)endbyte < 0)
>    297                  goto out;
>    298          if (endbyte < offset)
>                     ^^^^^^^^^^^^^^^^
> This is undefined but I think it works with the kernel build options?
> 

Yup.  -fno-strict-overflow.  Please see Dmitry's explanation at
https://bugzilla.kernel.org/show_bug.cgi?id=199099.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux