From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:53777 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759045AbcINIz3 (ORCPT ); Wed, 14 Sep 2016 04:55:29 -0400 Date: Wed, 14 Sep 2016 10:55:27 +0200 From: Johannes Thumshirn To: Bart Van Assche Cc: Jens Axboe , Mike Christie , Chris Mason , Josef Bacik , Mike Snitzer , Christoph Hellwig , Hannes Reinecke , Damien Le Moal , "linux-block@vger.kernel.org" , "linux-btrfs@vger.kernel.org" , device-mapper development Subject: Re: [PATCH 3/3] block: Improve bio_set_op_attrs() robustness Message-ID: <20160914085527.mjcurbe2zkbuqzwy@linux-x5ow.site> References: <35e3cdd6-8983-6c84-cb4c-9a7be15aea55@sandisk.com> <2a6c6cbd-ccc6-ee89-99ca-c0267cf17ec0@sandisk.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 In-Reply-To: <2a6c6cbd-ccc6-ee89-99ca-c0267cf17ec0@sandisk.com> Sender: linux-block-owner@vger.kernel.org List-Id: linux-block@vger.kernel.org On Wed, Sep 14, 2016 at 10:46:22AM +0200, Bart Van Assche wrote: > Since REQ_OP_BITS == 3 and __REQ_NR_BITS == 30 it is not that hard > to pass an op_flags argument to bio_set_op_attrs() that is larger > than the number of bits reserved for the op_flags argument. Complain > if this happens. Additionally, ensure that negative arguments trigger > a complaint (1 << ... is signed while 1U << ... is unsigned; adding > 0U to an integer expression causes it to be promoted to an unsigned > type). > > Signed-off-by: Bart Van Assche > Cc: Mike Christie > Cc: Christoph Hellwig > Cc: Hannes Reinecke > Cc: Damien Le Moal > --- Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:53777 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759045AbcINIz3 (ORCPT ); Wed, 14 Sep 2016 04:55:29 -0400 Date: Wed, 14 Sep 2016 10:55:27 +0200 From: Johannes Thumshirn To: Bart Van Assche Cc: Jens Axboe , Mike Christie , Chris Mason , Josef Bacik , Mike Snitzer , Christoph Hellwig , Hannes Reinecke , Damien Le Moal , "linux-block@vger.kernel.org" , "linux-btrfs@vger.kernel.org" , device-mapper development Subject: Re: [PATCH 3/3] block: Improve bio_set_op_attrs() robustness Message-ID: <20160914085527.mjcurbe2zkbuqzwy@linux-x5ow.site> References: <35e3cdd6-8983-6c84-cb4c-9a7be15aea55@sandisk.com> <2a6c6cbd-ccc6-ee89-99ca-c0267cf17ec0@sandisk.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 In-Reply-To: <2a6c6cbd-ccc6-ee89-99ca-c0267cf17ec0@sandisk.com> Sender: linux-btrfs-owner@vger.kernel.org List-ID: On Wed, Sep 14, 2016 at 10:46:22AM +0200, Bart Van Assche wrote: > Since REQ_OP_BITS == 3 and __REQ_NR_BITS == 30 it is not that hard > to pass an op_flags argument to bio_set_op_attrs() that is larger > than the number of bits reserved for the op_flags argument. Complain > if this happens. Additionally, ensure that negative arguments trigger > a complaint (1 << ... is signed while 1U << ... is unsigned; adding > 0U to an integer expression causes it to be promoted to an unsigned > type). > > Signed-off-by: Bart Van Assche > Cc: Mike Christie > Cc: Christoph Hellwig > Cc: Hannes Reinecke > Cc: Damien Le Moal > --- Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850