[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFj5m9J3KPtYkwUJjUiXBqK4t-5PRnZztHBiH5eS3yXmNhuBdw@mail.gmail.com>
Date: Thu, 27 Nov 2025 09:50:42 +0800
From: Ming Lei <ming.lei@...hat.com>
To: Kevin Brodsky <kevin.brodsky@....com>
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
Ali Utku Selen <ali.utku.selen@....com>, Jens Axboe <axboe@...nel.dk>
Subject: Re: [PATCH] ublk: prevent invalid access with DEBUG
On Wed, Nov 26, 2025 at 8:49 PM Kevin Brodsky <kevin.brodsky@....com> wrote:
>
> ublk_ch_uring_cmd_local() may jump to the out label before
> initialising the io pointer. This will cause trouble if DEBUG is
> defined, because the pr_devel() call dereferences io. Clang reports:
>
> drivers/block/ublk_drv.c:2403:6: error: variable 'io' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
> 2403 | if (tag >= ub->dev_info.queue_depth)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/block/ublk_drv.c:2492:32: note: uninitialized use occurs here
> 2492 | __func__, cmd_op, tag, ret, io->flags);
> |
>
> Fix this by initialising io to NULL and checking it before
> dereferencing it.
>
> Signed-off-by: Kevin Brodsky <kevin.brodsky@....com>
> ---
> Cc: Ali Utku Selen <ali.utku.selen@....com>
> Cc: Ming Lei <ming.lei@...hat.com>
> Cc: Jens Axboe <axboe@...nel.dk>
Reviewed-by: Ming Lei <ming.lei@...hat.com>
Powered by blists - more mailing lists