Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751365AbcDPBuY (ORCPT ); Fri, 15 Apr 2016 21:50:24 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:53362 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750886AbcDPBuX (ORCPT ); Fri, 15 Apr 2016 21:50:23 -0400 Date: Fri, 15 Apr 2016 18:50:21 -0700 From: Christoph Hellwig To: Jinpu Wang Cc: Jens Axboe , "linux-kernel@vger.kernel.org" Subject: Re: [PATCHv2]brd: set max_discard_sectors properly Message-ID: <20160416015021.GA3694@infradead.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 306 Lines: 6 > - blk_queue_max_discard_sectors(brd->brd_queue, UINT_MAX); > + blk_queue_max_discard_sectors(brd->brd_queue, UINT_MAX >> 9); Shouldn't we fix the issue by capping to UINT_MAX >> 9 inside blk_queue_max_discard_sectors? That way we'll prevent against having issues like this in any other driver as well.