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]
Message-ID: <CAK8P3a1ANjdbHt0x=o2WXB9AHbSj1xr1B-GOqzoKUagma3bBnA@mail.gmail.com>
Date:   Wed, 5 Jul 2017 14:06:50 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:     Ulf Hansson <ulf.hansson@...aro.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-mmc@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] mmc: block: Preinitialize ret in mmc_blk_issue_drv_op()

On Wed, Jul 5, 2017 at 11:07 AM, Geert Uytterhoeven
<geert@...ux-m68k.org> wrote:
> With gcc 4.1.2:
>
>     drivers/mmc/core/block.c: In function ‘mmc_blk_issue_drv_op’:
>     drivers/mmc/core/block.c:1178: warning: ‘ret’ may be used uninitialized in this function
>
> Indeed, if mq_rq->ioc_count is zero, an uninitialized value will be
> stored in mq_rq->drv_op_result and passed to blk_end_request_all().
>
> Can mq_rq->ioc_count be zero?
>   - mmc_blk_ioctl_cmd() sets ioc_count to 1, so this is safe,
>   - mmc_blk_ioctl_multi_cmd() obtains ioc_count from user space in
>     response to the MMC_IOC_MULTI_CMD ioctl, and does allow zero.
>
> Preinitialize ret to -EINVAL to fix this for current and future callers.
>
> Fixes: 0493f6fe5bdee8ac ("mmc: block: Move boot partition locking into a driver op")
> Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
> ---
> I assume -EINVAL is the error we want to return here if ioc_count is
> zero.
> Or should it return success (zero), like mmc_blk_ioctl_multi_cmd() used
> to do?

I would suggest adding the initialization after "case MMC_DRV_OP_IOCTL:"
instead, to keep getting compile-time checks on the state of the 'ret'
variable. In that case, returning '0' is probably good.

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ