Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753824AbbKCNyb (ORCPT ); Tue, 3 Nov 2015 08:54:31 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:52559 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750817AbbKCNy0 (ORCPT ); Tue, 3 Nov 2015 08:54:26 -0500 From: Arnd Bergmann To: Matias Bjorling , Jens Axboe Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] lightnvm: work around 32-bit built error Date: Tue, 03 Nov 2015 14:53:54 +0100 Message-ID: <4925999.tpkPGVQaeU@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:F7TyfZnFgIx7hIkSoEq7mIPEx4yHTCmWl/A4ua7tdPK1Sp39nfz dXYRJhp0/vpI0z27KbTiRu1zr9kz1kqfliBwDnFnppuIz+eMHH9yyBgzrG2oMfmwXogdg0M PiNLJnchu24XPSBb96tCV2T0/gmYglTg1WkTPepT2cyKlJtlRQnPhxshtRcQv1E1QjtYmn8 1nBaWcUuQoySJbsRqKurA== X-UI-Out-Filterresults: notjunk:1;V01:K0:WgrEyiQ3IVk=:N/omsPPpfVLnNMRBW2p2hj 6pnSkPPIzq7QO7ZW/tk1vxeju1+OUaqjoVn8dyJVaa1r+EGqdC5RUaJqpYxpDmkHDzftOMhun AFixptoCzNSxeRXgT/QhVLQCDw+O/P7ADTDG8lWgTqI+9fwPuFoSSvfxLh0TczIzsTvV+k1ac RS8fS6FFrGTFEdp6KJvgWI1mBTo53hpsr5ovA9JjicBEHwTc2Brd2PCCmBZvAQcL/38G7VtfM 2riX1qteMeW7s0z4rP0vCfzxZvO0OX6eoAXahVeJnXXkdfbbVLNSf9bMsaWjoyc2fsJJjKQH/ BYifkcNLdLCgiI442gD3qNjsz+bJee6TjIfg0i2Jxjuxm66gbcpAc2bUS27kolFL0GhS9EczM UzfpR6bqBDjl7KeyZsfamkRDDxwUeBKfekvkJPUKXvG7kGnbKhjuGgaI/ZPWbGm0S9gCrJ0Hv XztopO+keIhqQI5t0cwBvKM9UQ8xetbLYKkiOZrenSFP+fneIN6JQqQyT48VaUnB/kpQDQWqV W5i2xpToA1AsOGztpVKtgQwYNhl7IXrX6USiji+XzJDhjgjTyU6P+fyFs16uFzz9t/2M87yoc 5+hvOCL7qADbLnlBFjwcHfYASYsDUx6i/JPelAQ5aEUpfrnUXDS+r9Y3UKD3xX5FOIIUWjivP MFbfA6QBWligTLCh10QN/uNPdcH480gH3Sgne3Re1+ejebPHBbT4kwAXFXVokigXwZoKUIw54 EmlaqWbui+4YxR4Z Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2686 Lines: 77 The newly added lightnvm incorrectly uses a sector_t variable to represent a data structure with fixed length bit fields, which breaks when sector_t is configured to be 32-bit: In file included from ../drivers/lightnvm/core.c:29:0: /include/linux/lightnvm.h:143:4: error: width of 'resved' exceeds its type sector_t resved : 36; include/linux/lightnvm.h: In function 'ppa_set_empty': /include/linux/lightnvm.h:120:20: warning: large integer implicitly truncated to unsigned type [-Woverflow] #define ADDR_EMPTY (~0ULL) This patch resolves the build error, but does not address the fact that bit fields are not reliable in data structures that are interpreted by firmware on another architecture. If the layout is meant to be stable, the bit fields should be replaced with explicit calculations. Signed-off-by: Arnd Bergmann Fixes: cd9e9808d18f ("lightnvm: Support for Open-Channel SSDs") --- Found on ARM randconfig tests in linux-next diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index 122b176600fa..b094e9ebf715 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -130,30 +130,31 @@ struct nvm_tgt_instance { #define NVM_LUN_BITS (10) #define NVM_CH_BITS (8) +/* FIXME: bit fields are not endian safe! */ struct ppa_addr { union { /* Channel-based PPA format in nand 4x2x2x2x8x10 */ struct { - sector_t ch : 4; - sector_t sec : 2; /* 4 sectors per page */ - sector_t pl : 2; /* 4 planes per LUN */ - sector_t lun : 2; /* 4 LUNs per channel */ - sector_t pg : 8; /* 256 pages per block */ - sector_t blk : 10;/* 1024 blocks per plane */ - sector_t resved : 36; + __u64 ch : 4; + __u64 sec : 2; /* 4 sectors per page */ + __u64 pl : 2; /* 4 planes per LUN */ + __u64 lun : 2; /* 4 LUNs per channel */ + __u64 pg : 8; /* 256 pages per block */ + __u64 blk : 10;/* 1024 blocks per plane */ + __u64 resved : 36; } chnl; /* Generic structure for all addresses */ struct { - sector_t sec : NVM_SEC_BITS; - sector_t pl : NVM_PL_BITS; - sector_t pg : NVM_PG_BITS; - sector_t blk : NVM_BLK_BITS; - sector_t lun : NVM_LUN_BITS; - sector_t ch : NVM_CH_BITS; + __u64 sec : NVM_SEC_BITS; + __u64 pl : NVM_PL_BITS; + __u64 pg : NVM_PG_BITS; + __u64 blk : NVM_BLK_BITS; + __u64 lun : NVM_LUN_BITS; + __u64 ch : NVM_CH_BITS; } g; - sector_t ppa; + __u64 ppa; }; } __packed; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/