From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752883AbbKLA6Z (ORCPT ); Wed, 11 Nov 2015 19:58:25 -0500 Received: from g2t1383g.austin.hp.com ([15.217.136.92]:7456 "EHLO g2t1383g.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753200AbbKLA46 convert rfc822-to-8bit (ORCPT ); Wed, 11 Nov 2015 19:56:58 -0500 From: "Seymour, Shane M" To: "Darrick J. Wong" CC: Jens Axboe , Christoph Hellwig , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-api@vger.kernel.org" , Jeff Layton , "J. Bruce Fields" , "martin.petersen@oracle.com" Subject: RE: [PATCH] block: create ioctl to discard-or-zeroout a range of blocks Thread-Topic: [PATCH] block: create ioctl to discard-or-zeroout a range of blocks Thread-Index: AQHRG3bpCSLWwRku1USJ2RZTZkapa56WNDAQgAAlW4CAARm1IIAAG+qQ Date: Thu, 12 Nov 2015 00:56:02 +0000 Message-ID: References: <20151110051526.GA2217@birch.djwong.org> <20151111061435.GA32272@birch.djwong.org> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [16.210.48.29] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > which would make the other checks I suggested to ensure that neither start > or end were more than (uint64_t)LLONG_MAX unnecessary. My apologies I was wrong about what I said above - after thinking about it for longer you still need to make sure that at least len is not greater than (uint64_t)LLONG_MAX because in the calculation: if (start > (uint64_t)LLONG_MAX - len) return -EINVAL; if len was more than (uint64_t)LLONG_MAX it would underflow and become a very large positive number and start would never be greater than that (and I said end when I should have said len).