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:   Mon, 2 Jul 2018 09:10:56 +0800
From:   cgxu519 <cgxu519@....com>
To:     rjw@...ysocki.net
Cc:     pavel@....cz, cgxu519@....com, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel/power: cast PAGE_SIZE to int when comparing with
 error code

Hi Rafael,

Could you have a look at this simple patch?

Thanks,
Chengguang


On 06/25/2018 01:30 PM, Chengguang Xu wrote:
> If PAGE_SIZE is unsigned type then negative error code will be
> larger than PAGE_SIZE.
>
> Signed-off-by: Chengguang Xu <cgxu519@....com>
> ---
>   kernel/power/swap.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/power/swap.c b/kernel/power/swap.c
> index c2bcf97d24c8..d7f6c1a288d3 100644
> --- a/kernel/power/swap.c
> +++ b/kernel/power/swap.c
> @@ -923,7 +923,7 @@ int swsusp_write(unsigned int flags)
>   	}
>   	memset(&snapshot, 0, sizeof(struct snapshot_handle));
>   	error = snapshot_read_next(&snapshot);
> -	if (error < PAGE_SIZE) {
> +	if (error < (int)PAGE_SIZE) {
>   		if (error >= 0)
>   			error = -EFAULT;
>   
> @@ -1483,7 +1483,7 @@ int swsusp_read(unsigned int *flags_p)
>   
>   	memset(&snapshot, 0, sizeof(struct snapshot_handle));
>   	error = snapshot_write_next(&snapshot);
> -	if (error < PAGE_SIZE)
> +	if (error < (int)PAGE_SIZE)
>   		return error < 0 ? error : -EFAULT;
>   	header = (struct swsusp_info *)data_of(snapshot);
>   	error = get_swap_reader(&handle, flags_p);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ