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] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gTK79W5RK3v+4GPN+EN68EHoDhbQjxi7t-bHASTxcFhw@mail.gmail.com>
Date:   Thu, 21 Oct 2021 12:49:07 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Anders Roxell <anders.roxell@...aro.org>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
        Linux PM <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel: power: swap: fix sparse warnings

On Thu, Oct 7, 2021 at 9:13 PM Anders Roxell <anders.roxell@...aro.org> wrote:
>
> When building the kernel with sparse enabled 'C=1' the following
> warnings shows up:
>
> kernel/power/swap.c:390:29: warning: incorrect type in assignment (different base types)
> kernel/power/swap.c:390:29:    expected int ret
> kernel/power/swap.c:390:29:    got restricted blk_status_t
>
> This is due to function hib_wait_io() returns a 'blk_status_t' which is
> a bitwise u8. Commit 5416da01ff6e ("PM: hibernate: Remove
> blk_status_to_errno in hib_wait_io") seemed to have mixed up the return
> type. However, the 4e4cbee93d56 ("block: switch bios to blk_status_t")
> actually broke the behaviour by returning the wrong type.
>
> Rework so function hib_wait_io() returns a 'int' instead of
> 'blk_status_t' and make sure to call function
> blk_status_to_errno(hb->error)' when returning from function
> hib_wait_io() a int gets returned.
>
> Fixes: 4e4cbee93d56 ("block: switch bios to blk_status_t")
> Fixes: 5416da01ff6e ("PM: hibernate: Remove blk_status_to_errno in hib_wait_io")
> Signed-off-by: Anders Roxell <anders.roxell@...aro.org>
> ---
>  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 9ec418955556..47107f9cd14c 100644
> --- a/kernel/power/swap.c
> +++ b/kernel/power/swap.c
> @@ -299,14 +299,14 @@ static int hib_submit_io(int op, int op_flags, pgoff_t page_off, void *addr,
>         return error;
>  }
>
> -static blk_status_t hib_wait_io(struct hib_bio_batch *hb)
> +static int hib_wait_io(struct hib_bio_batch *hb)
>  {
>         /*
>          * We are relying on the behavior of blk_plug that a thread with
>          * a plug will flush the plug list before sleeping.
>          */
>         wait_event(hb->wait, atomic_read(&hb->count) == 0);
> -       return hb->error;
> +       return blk_status_to_errno(hb->error);
>  }
>
>  /*
> --

Applied as 5.16 material, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ