From patchwork Fri Feb 24 17:16:49 2017 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: 9590827 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D5306020A for ; Fri, 24 Feb 2017 17:17:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4379C2871E for ; Fri, 24 Feb 2017 17:17:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35CE928727; Fri, 24 Feb 2017 17:17:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE8BE28711 for ; Fri, 24 Feb 2017 17:17:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751386AbdBXRRa (ORCPT ); Fri, 24 Feb 2017 12:17:30 -0500 Received: from mail-by2nam03on0073.outbound.protection.outlook.com ([104.47.42.73]:11538 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750995AbdBXRRY (ORCPT ); Fri, 24 Feb 2017 12:17:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cnexlabs.onmicrosoft.com; s=selector1-cnexlabs-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=yLChJpWHUbF9MuwdbNjwmmNk9il96HhVKEYoEOI/oqE=; b=h+3wB488iPwZaQIlYUcqBk6eccFplHoi4vBaBin1vOXISnfG7B5NKpMG1k+k06vEvwklZguEQvsHDUn2+veG5+cDpPdzMFb0NmKH71iKY0ID5uCrgeDP7lOa+D2HQGO2lW/e63Dc2NFXOZDChuBEbggsapuG2tOFBsku3rsQKUw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matias@cnexlabs.com; Received: from skyninja.cnexlabs.com (193.106.164.211) by MWHPR06MB2784.namprd06.prod.outlook.com (10.175.137.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Fri, 24 Feb 2017 17:17:21 +0000 From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: , CC: =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 2/2] lightnvm: fix assert fixes and enable checks Date: Fri, 24 Feb 2017 18:16:49 +0100 Message-ID: <20170224171649.27409-2-matias@cnexlabs.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170224171649.27409-1-matias@cnexlabs.com> References: <20170224171649.27409-1-matias@cnexlabs.com> MIME-Version: 1.0 X-Originating-IP: [193.106.164.211] X-ClientProxiedBy: AM5PR0602CA0008.eurprd06.prod.outlook.com (10.175.46.146) To MWHPR06MB2784.namprd06.prod.outlook.com (10.175.137.141) X-MS-Office365-Filtering-Correlation-Id: 0f25a77a-7a66-41d2-3aef-08d45cd8ff0f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:MWHPR06MB2784; X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2784; 3:a/s2BAbe/AV/KUd+SvEuVgS/lDyfuc9lMTQQ3udzxUZyOfbzWiaA5FJvBL7UpmbBZklYGPVuroyUEcYnYgXFkLASuNYiIKILHmI6g/5Nfmd3LLTIk39jDuhCWA3VutYwl7UOB1jb7X0RzlBaDuEt8SBhCMfkJW9DwmeR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am-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123562025)(20161123558025)(20161123560025)(20161123564025)(20161123555025)(6072148); SRVR:MWHPR06MB2784; BCL:0; PCL:0; RULEID:; SRVR:MWHPR06MB2784; X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2784; 4:E8VyKodVhHcYMyxCQ+Cv6ZN5EQEKWVqi7yh91zPlPxBcGVIBdQKFYWEJ4sy8LAcmPdkLo1LG+JOQqv9hY1iIub+Qwmn0Op25aVtktFvtInMN23vVmTt9SB8rxfOGHrOrFDCthutGAXDc640I+AgbNVIe+X7edo+dKDIzn20QaoZQcSiBm003wgyLsL3UeQ257mv0QDQfjDC8SRQHKoTnqdwY4DECI3P0NR+wGl8NE0gLizExiGmZP7bgvtbg4HbOYqE/zFnX+B3UZmhSSveQKmohkbtVXwCPaGo5vDsbj3wk2+K+0sM/ksyIU+i+1UD9o+Hfljq9DKUftwXItf3jhoHwaAHLCpgZVDlWinJJx0f89G2tV5mefuzMJxKUwilYHB6t86spWC0ceUBlz0qnc/lYfy3k1UPfGJ8nO16csS+Xmii9ZZaBME65auORa8RoUSRf4LAs8it3iwYC8+fQlhglfUgiF7KDIhHL1PChLUJ4Zbda/wTbIkB6JDwmg0eZbycR1HaBO6C7b9NzmQcqUlGX2+Tyi5/CPopJgmyVfLpqzvpzhBMZ+8Ng55BB+IrjQpA96HTc3rj+Q6k3+hFKlQdxgbDK3GovF6xrPm0H8Ek1HgnvGYqxz2uUmfwj9P7Vz9vfQ2ySqwnYNTAOVCNkZg== X-Forefront-PRVS: 0228DDDDD7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(199003)(189002)(97736004)(105586002)(92566002)(25786008)(86362001)(36756003)(189998001)(76176999)(106356001)(50466002)(38730400002)(107886003)(450100001)(66066001)(2870700001)(47776003)(7736002)(305945005)(42186005)(53936002)(5820100001)(53416004)(2950100002)(50986999)(6666003)(81166006)(1076002)(81156014)(23676002)(8676002)(6116002)(3846002)(50226002)(5660300001)(68736007)(2906002)(101416001)(4326007)(33646002)(6486002)(69596002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR06MB2784; H:skyninja.cnexlabs.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cnexlabs.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjA2TUIyNzg0OzIzOk8yR09zTVk3RDg1TXJ3NEw4WDc3cVpnTDNB?= =?utf-8?B?Q0ZhT3JkNXQ4aVlUdHZOT25UY0Rmc2ROWGsvOFQ3WEw4cnowbEhrUVkrSWNt?= =?utf-8?B?aGN6TnlZSzN6M2Nyc0dOcVd6NHFPL2QzZlVOcE9NVjZDTDlzYzlGelk0RGNG?= =?utf-8?B?Yy9RODVKNTNaajBtMmdJUXI0Q3I0YXZVTURRdjExaEhjRzVlUzFtNWIrVkQr?= =?utf-8?B?S1BlVSszdk5CdS9JNWl2SHNPOHJJV01TVk90ZDlCRDJoRjlHZERjTGRBU1dz?= =?utf-8?B?dUwwNHNSSjFFeGloOU41RVZsdngzWnAyQlVhTG9jcFlOSFVVaGZLR1A0aDhJ?= =?utf-8?B?REhmZVpPa1JMbGFVM3lTdCsvMXFQK0FmMm1ORW91aFQwTFhwNllqNFJTdkRC?= =?utf-8?B?NW1JODlselBGTFF6K2RROGhhWm95bHd5NENPcGdxb1FyRzFZUW5GVmx2TG1i?= =?utf-8?B?UmFxVFFzOXN5c1BSNWc5TmkzN3V0ZjlZcE51LytiZ2RjMlU5MSt0dDBKcUYz?= =?utf-8?B?bit0UVJaQmxGSkxXMm5YbGVIU0l2c2F2TmhQOXRBMElMSWtIbXVPWE05Syt5?= =?utf-8?B?SGNORjN0UDZ5QnNWQ1Eyc0lSS2hCOElWRHNC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VN2Hj4An4mQUodyham?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2784; 6:S03jamDN3fapzzpFiRVkyJQ05uDmgwFZ4TuLiov+rppdhHtxAY1gfiXP34GsHvFZUjWB92QfQHtaE5mGZIGAiWt/kN3K7R79dY30lef/dqE3AMSSaUktVVOf/htw075GhigQ+hcH32GWPpcZUHCw2hUBT/VlyX/LS4MDqF0knAJKOou15dvquVOhNAtSJJG8smP9xZ39qYNm6Tj+ETDwd6UYpe05krLf0zvY8OWKnPCVe07FcUQK00/iXTC7SxvtaAU4znPnipELQtRhru+4SV6iLk7GQG9AflDaGvSlU13Rd35H5u809FNHkYwdAzQ7ObPQCMw3K2arnhdDFqFu6MaX0h1iBUakGjtHNh4vS6s9LfJdn6YLtRw20RBl/6+gR+ENUyCha4PHYWJMxJIIjQ==; 5:7dzbmB3RpakIqoh2F5LOhCUzumxzmZtLAM4DjHeyGlUonZzsmwpk5X4/JfvFkQEDOXvNKFRjZn06qSIDJZvZmvbuDOrYLetCT103Y4i5OWdjienbRFUPHucqSz/OlnI11BHq+l2DwDtwvdjUBd6a0Q==; 24:pPtwY7XY9ldqd6ZNHckKyzinv+F00j81VEKOv/Vyn+BEy5SRnm/YGh4uYDEzNGs1nKn5WxVpnxu3b7md2kQ9yP8yX/rs9p2Hmt2Of4fDztg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2784; 7:dtdA9lv5yvW+rO9AWH2d72LZ9tWxJDgf2WZPZGcD2ULYqbV5aqB/nK/qX0WIIcNB8Gs9RbRY1OW+usCgxLv7Hzam9CV3ajOxVyYIwsDjxkvbfDKFLGhDTCOIDwcjv+T+foLlvBxqsnShJ+EBGzbticchP5lD/ze4a1J77RJZnXw0X0dB7KF/CV5OzqHqlOIwhTgG3IVQf/XdThbsWgX+s7posb7o4yBwKPd4Iq878mTb5bvOXZND2fkeyZEqPfw5RqI/nX+88DxJbJhjK6JQ9UDxTA26auG/aCA23MVEsvPISuc1yqA2FQSv0rhFladyzcDgBmgnTh7OvJket3b5YA== X-OriginatorOrg: cnexlabs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2017 17:17:21.9575 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR06MB2784 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The asserts in _nvme_nvm_check_size are not compiled due to the function not begin called. Make sure that it is called, and also fix the wrong sizes of asserts for nvme_nvm_addr_format, and nvme_nvm_bb_tbl, which checked for number of bits instead of bytes. Reported-by: Scott Bauer Signed-off-by: Matias Bjørling --- drivers/nvme/host/lightnvm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index e37b432..b6a67ad 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -241,9 +241,9 @@ static inline void _nvme_nvm_check_size(void) BUILD_BUG_ON(sizeof(struct nvme_nvm_l2ptbl) != 64); BUILD_BUG_ON(sizeof(struct nvme_nvm_erase_blk) != 64); BUILD_BUG_ON(sizeof(struct nvme_nvm_id_group) != 960); - BUILD_BUG_ON(sizeof(struct nvme_nvm_addr_format) != 128); + BUILD_BUG_ON(sizeof(struct nvme_nvm_addr_format) != 16); BUILD_BUG_ON(sizeof(struct nvme_nvm_id) != 4096); - BUILD_BUG_ON(sizeof(struct nvme_nvm_bb_tbl) != 512); + BUILD_BUG_ON(sizeof(struct nvme_nvm_bb_tbl) != 64); } static int init_grps(struct nvm_id *nvm_id, struct nvme_nvm_id *nvme_nvm_id) @@ -797,6 +797,8 @@ int nvme_nvm_register(struct nvme_ns *ns, char *disk_name, int node) struct request_queue *q = ns->queue; struct nvm_dev *dev; + _nvme_nvm_check_size(); + dev = nvm_alloc_dev(node); if (!dev) return -ENOMEM;