From patchwork Thu Nov 12 18:35:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 7604841 X-Patchwork-Delegate: axboe@kernel.dk Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5F2EB9F1C2 for ; Thu, 12 Nov 2015 18:35:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 885C72078B for ; Thu, 12 Nov 2015 18:35:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B1BDA20739 for ; Thu, 12 Nov 2015 18:35:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753734AbbKLSfM (ORCPT ); Thu, 12 Nov 2015 13:35:12 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:35796 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752928AbbKLSfL (ORCPT ); Thu, 12 Nov 2015 13:35:11 -0500 Received: by wmdw130 with SMTP id w130so166648128wmd.0 for ; Thu, 12 Nov 2015 10:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=29eZ7QmumYRD2p9LAlED0Wd6W1NHo7YR3E7eS90RIOg=; b=jQY5+fuobChWKEQ/dUgws6hDPvfZCmO2qH4Ee2l7Z9BQfcJuCr1YE67m3hBn94oNx3 A18oWLiCfM/JmFxHJ8TuafQJjhAQOkRkLfIRfe51BlY2+v/m10DpzUDS5aY4Da1q0HSs oIf5laeEmGzBbXyO1bLBZy2X9DPAEKdVT7O0o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=29eZ7QmumYRD2p9LAlED0Wd6W1NHo7YR3E7eS90RIOg=; b=GDf9zxWbObaXwhRV1YIDKerZn78agIpx0/uf0J9+pBK7FzYt2tCOluNUzJ8nnGWCf0 GjbdXiBAcyIr5naGxSkC6ePBWSwtUtNW+G0nVKbsCSbNTxOTDLLz42dQCMy3omZHRqiU Vdc64Upz0IRB/ZuTcwMcEwr5gApnYbybOUHr4QeDfSIu5Vb46c7Z9sRS+aRxfQzhgLJn 0siuy67c2uJHKQ81Iw48wzbH25klehqIeVF5aYDKzVHB8zwyyH6ZyceF2BS8NU3wYqvt gR2/Ai0+8EjNEA5QVaj6fCcgz3ZQjQ00SFhDpRpnmVUSK9dcFU005b+EAmnR2AsrzHSk Nc5w== X-Gm-Message-State: ALoCoQlIuiAlKecOX4VQFzMnL7ldNIWfjfqP7sxKE/Z/frSza8x3jazTn9ti1UlOba4Fhg1iOCcT X-Received: by 10.28.5.208 with SMTP id 199mr18897138wmf.40.1447353309989; Thu, 12 Nov 2015 10:35:09 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id q3sm15781946wjr.34.2015.11.12.10.35.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Nov 2015 10:35:09 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: axboe@fb.com, geert@linux-m68k.org, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH] lightnvm: change max_phys_sect to ushort Date: Thu, 12 Nov 2015 19:35:00 +0100 Message-Id: <1447353300-26027-1-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The max_phys_sect variable is defined as a char. We do a boundary check to maximally allow 256 physical page descriptors per command. As we are not indexing from zero. This expression is always in false. Bump the max_phys_sect to an unsigned short to support the range check. Signed-off-by: Matias Bjørling Reported-by: Geert Uytterhoeven --- include/linux/lightnvm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index 69c9057..4b1cd3d 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -220,7 +220,7 @@ struct nvm_dev_ops { nvm_dev_dma_alloc_fn *dev_dma_alloc; nvm_dev_dma_free_fn *dev_dma_free; - uint8_t max_phys_sect; + unsigned int max_phys_sect; }; struct nvm_lun {