From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Snitzer Subject: Re: dm ebs: fix bio->bi_status assignment Date: Wed, 29 Apr 2020 11:22:53 -0400 Message-ID: <20200429152253.GA22958@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Content-Disposition: inline To: heinzm@redhat.com Cc: dm-devel@redhat.com List-Id: dm-devel.ids On Wed, Apr 29 2020 at 11:07am -0400, heinzm@redhat.com wrote: > From: Heinz Mauelshagen > > Assign blk_status_t to bi_status properly in __ebs_process_bios() > on error (flaw found by static checker). > > Reported-by: Dan Carpenter > Signed-off-by: Heinz Mauelshagen > --- > drivers/md/dm-ebs-target.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/md/dm-ebs-target.c b/drivers/md/dm-ebs-target.c > index 97703c31771f..c9c66d6b1e56 100644 > --- a/drivers/md/dm-ebs-target.c > +++ b/drivers/md/dm-ebs-target.c > @@ -210,7 +210,8 @@ static void __ebs_process_bios(struct work_struct *ws) > r = __ebs_discard_bio(ec, bio); > } > > - bio->bi_status = r; > + if (r < 0) > + bio->bi_status = BLK_STS_IOERR; > } > > /* > -- > 2.25.4 > Proper way is to use errno_to_blk_status(). I've folded in: - bio->bi_status = r; + if (r < 0) + bio->bi_status = errno_to_blk_status(r);