From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751613AbcERFeN (ORCPT ); Wed, 18 May 2016 01:34:13 -0400 Received: from smtp1.it.da.ut.ee ([193.40.5.66]:40239 "EHLO smtp1.it.da.ut.ee" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751168AbcERFeL (ORCPT ); Wed, 18 May 2016 01:34:11 -0400 Date: Wed, 18 May 2016 09:59:11 +0300 (EEST) From: Meelis Roos To: Bartlomiej Zolnierkiewicz cc: Linux Kernel list , linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Tejun Heo , Jens Axboe Subject: Re: UBSAN: Undefined behaviour in block/blk-mq.c:1459:27 with pata_amd In-Reply-To: <22191628.vH7YQZ1hRO@amdc1976> Message-ID: References: <22191628.vH7YQZ1hRO@amdc1976> User-Agent: Alpine 2.20 (LRH 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Does the patch below help? > > From: Bartlomiej Zolnierkiewicz > Subject: [PATCH] blk-mq: fix undefined behaviour in order_to_size() > > When this_order variable in blk_mq_init_rq_map() becomes zero > the code incorrectly decrements the variable and passes the result > to order_to_size() helper causing undefined behaviour: > > UBSAN: Undefined behaviour in block/blk-mq.c:1459:27 > shift exponent 4294967295 is too large for 32-bit type 'unsigned int' > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc6-00072-g33656a1 #22 > > Fix the code by checking this_order variable for not having the zero > value first. > > Reported-by: Meelis Roos > Fixes: 320ae51feed5 ("blk-mq: new multi-queue block IO queueing mechanism") > Signed-off-by: Bartlomiej Zolnierkiewicz It fixes the warning independently of the pata driver - ata_piix pata_via pata_serverworks pata_macio 3ware were fixed too. -- Meelis Roos (mroos@linux.ee)