From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754157AbcEPPzp (ORCPT ); Mon, 16 May 2016 11:55:45 -0400 Received: from mail-ig0-f170.google.com ([209.85.213.170]:37778 "EHLO mail-ig0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753736AbcEPPzo (ORCPT ); Mon, 16 May 2016 11:55:44 -0400 Subject: Re: UBSAN: Undefined behaviour in block/blk-mq.c:1459:27 with pata_amd To: Bartlomiej Zolnierkiewicz , Meelis Roos References: <22191628.vH7YQZ1hRO@amdc1976> Cc: Linux Kernel list , linux-ide@vger.kernel.org, linux-block@vger.kernel.org, Tejun Heo From: Jens Axboe Message-ID: <5739ED73.4020009@kernel.dk> Date: Mon, 16 May 2016 09:55:31 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <22191628.vH7YQZ1hRO@amdc1976> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/13/2016 09:31 AM, Bartlomiej Zolnierkiewicz wrote: > 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. Thanks Bart, added for 4.7. -- Jens Axboe