From patchwork Thu Nov 12 19:11:06 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: 7605001 X-Patchwork-Delegate: axboe@kernel.dk Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 66860BF90C for ; Thu, 12 Nov 2015 19:13:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D71120814 for ; Thu, 12 Nov 2015 19:13:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D87820810 for ; Thu, 12 Nov 2015 19:13:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753481AbbKLTM3 (ORCPT ); Thu, 12 Nov 2015 14:12:29 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:34138 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752304AbbKLTM2 (ORCPT ); Thu, 12 Nov 2015 14:12:28 -0500 Received: by wmvv187 with SMTP id v187so48872144wmv.1 for ; Thu, 12 Nov 2015 11:12:27 -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=+8gH8voDOj/rGLnrYdgZ5FbPvBqxWY6u1jdhvCLMHJY=; b=Hk0mHwAUnRxpckZfyfOrLswrFcDerClxZLRFG3B7pssozxY8lZj1kl0QStq5UdQyp5 AeOayLmS2SUkPbEVmgdHMy5JEuJQkIiDrj1mqXlRsMLIkk2qJr2hV5n0BHODQjDYkwUS hIe2wpDLXx/tZ8opXMHzLVrJvgtiAg3uH8UQE= 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=+8gH8voDOj/rGLnrYdgZ5FbPvBqxWY6u1jdhvCLMHJY=; b=cBqXRGj6ZAVKTvY5uOEXf1/+IRwjQ8WLGFog5J9KOBoxUaOGxDAXeousIKpM0egV5D jgMzL8nIq3w5R1ht7KAdpK/QzJJU1dak2EKwvIPp9C42TuU4fxJ4FyWcgFD/Ix3PMFKl /90Vi17aJZiIUe0qx5yEa7TdU0VSVPAL26fcFiPj9IK+RYdT9uKwSulLKwmDCZXhlRNd eBa9cDyJQHruLM/YvO9aukj8N6t3erWhv3IybDkDnOVOH4f6EC69qC2HGrn9cUed2heH KeykCT5VS5l30wlu6KN49cKj+gkLGn8z39BObSFV+mR0i7iiviqkq6c3VYJ+xawR7CVB 7aPQ== X-Gm-Message-State: ALoCoQlkD53DxH0m+keHUisB/jDI2Fjt0uvU6X3/Ki9Z6lIHkrl1NZQ/x2EXIA9P4+WzpeMltqDH X-Received: by 10.28.145.194 with SMTP id t185mr43593752wmd.65.1447355546515; Thu, 12 Nov 2015 11:12:26 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id 71sm30225wmt.15.2015.11.12.11.12.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Nov 2015 11:12:25 -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 v3] lightnvm: change max_phys_sect to uint Date: Thu, 12 Nov 2015 20:11:06 +0100 Message-Id: <1447355466-20443-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 false. Bump the max_phys_sect to an unsigned int 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..e8bc52a 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 {