Re: [PATCH v2 1/5] fcntl: Cast commands with int args explicitly

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

 



On Fri, Apr 14, 2023 at 04:24:55PM +0100, Luca Vizzarro wrote:
>  	void __user *argp = (void __user *)arg;
> +	int argi = (int)arg;

Strictly speaking, conversion from unsigned long to int is
an undefined behaviour, unless the value fits into the
range representable by int ;-)

>  	case F_SETFD:
>  		err = 0;
> -		set_close_on_exec(fd, arg & FD_CLOEXEC);
> +		set_close_on_exec(fd, argi & FD_CLOEXEC);

Why?

>  	case F_SETSIG:
>  		/* arg == 0 restores default behaviour. */
> -		if (!valid_signal(arg)) {
> +		if (!valid_signal(argi)) {

Why???

>  			break;
>  		}
>  		err = 0;
> -		filp->f_owner.signum = arg;
> +		filp->f_owner.signum = argi;
>  		break;

These two are clearly bogus and I'd like to see more details
on the series rationale, please.



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

  Powered by Linux