Re: [PATCH] fs/compat: remove redundant 'less than zero' check

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

 




On Fri, 24 Apr 2015, Firo Yang wrote:

> Smatch complains about the check in compat.c.
> fs/compat.c:565 compat_rw_copy_check_uvector() warn:
> unsigned 'nr_segs' is never less than zero.
>
> I think, there is no reason to check if the value nr_segs
> is less than zero. So I removed it.

It would be good to explain why you think this.  What other statements in
the code imply this property?

julia

>
> Signed-off-by: Firo Yang <firogm@xxxxxxxxx>
> ---
>  fs/compat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/compat.c b/fs/compat.c
> index 6fd272d..beaf15b 100644
> --- a/fs/compat.c
> +++ b/fs/compat.c
> @@ -562,7 +562,7 @@ ssize_t compat_rw_copy_check_uvector(int type,
>  		goto out;
>
>  	ret = -EINVAL;
> -	if (nr_segs > UIO_MAXIOV || nr_segs < 0)
> +	if (nr_segs > UIO_MAXIOV)
>  		goto out;
>  	if (nr_segs > fast_segs) {
>  		ret = -ENOMEM;
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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