From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966818AbcAZQn7 (ORCPT ); Tue, 26 Jan 2016 11:43:59 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:53411 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966799AbcAZQn4 (ORCPT ); Tue, 26 Jan 2016 11:43:56 -0500 Date: Tue, 26 Jan 2016 08:43:54 -0800 From: Greg KH To: Andrey Ryabinin Cc: Alan Stern , Chris Bainbridge , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: UBSAN: Undefined behaviour in drivers/usb/core/devio.c:1517:25 Message-ID: <20160126164354.GA19916@kroah.com> References: <56A798DB.8000200@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56A798DB.8000200@virtuozzo.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 26, 2016 at 07:03:39PM +0300, Andrey Ryabinin wrote: > On 01/26/2016 06:25 PM, Alan Stern wrote: > > On Tue, 26 Jan 2016, Chris Bainbridge wrote: > > > >> Booting 4.5.0-rc1 with new UBSAN checker enabled: > >> > >> [ 4.556968] ================================================================================ > >> [ 4.556972] UBSAN: Undefined behaviour in drivers/usb/core/devio.c:1517:25 > >> [ 4.556975] shift exponent -1 is negative > > > > Does a left shift by a negative amount matter if the result isn't used? > > > > By definition, any code with undefined behavior could do anything. But in reality, we are ok here, gcc isn't that foolish. > But in practice, undefined shift just leads to undefined result of shift operation > (it depends on operands and architecture). But if we don't use the value... Anyway, please send a patch if you wish this issue to be fixed and we can discuss it that way. thanks, greg k-h