From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38E69C433F5 for ; Mon, 8 Nov 2021 01:34:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1665660184 for ; Mon, 8 Nov 2021 01:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235923AbhKHBhN (ORCPT ); Sun, 7 Nov 2021 20:37:13 -0500 Received: from mail-pf1-f169.google.com ([209.85.210.169]:33583 "EHLO mail-pf1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235013AbhKHBhK (ORCPT ); Sun, 7 Nov 2021 20:37:10 -0500 Received: by mail-pf1-f169.google.com with SMTP id c126so6045648pfb.0; Sun, 07 Nov 2021 17:34:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mWr9Mi5YMHTa3T07Gk34FemQhAzXo7wj/0HuBoS0oBY=; b=Pt8Z4Lf10GJMEjgBmaRbSNZKR8/o8qH8TsW0Ah4iPRuFj77QPewiDIlMspj7Rk8Rh/ INHjTpDsNin1fj7L6iQbV9/3oOD03LCzbhJN3FXbGUxolGMPOeWpYWHrZn4UZhG+eWH5 P+NP4X7lqiqmigAcj+nBOfbBUqse7aqBg9Esvxbj2YEKade+FpIyQEzz5LDse3AUVtRs S++jkvcVOP6G7h9eOOcR41YH+0E/0IsJR42PmfmrOL9hoUV9v/5Js9O4+ZVK0XQPvhQ8 wik9c7Qp4ZYnIja/N1p4QPR1I2mkAx43yqa9KKJr2EidGFiy0UIOkWjUe0aaPeHPE3NL LYFw== X-Gm-Message-State: AOAM533OokXp+eXoH6d19XTR4DxjSNFkcCOqB4Emm6R0iLTC2olNbc8p OPU9K4ZRaY0y2URRBjkP6z8= X-Google-Smtp-Source: ABdhPJyvrldzJctNqWP3qBig1k4nT4bAAzfVHptACo0tnM9HY/IvC+DM5RmBWCI0a12eDwKJDoZ1KQ== X-Received: by 2002:a62:7f4a:0:b0:44d:292f:cc24 with SMTP id a71-20020a627f4a000000b0044d292fcc24mr77899278pfd.58.1636335266915; Sun, 07 Nov 2021 17:34:26 -0800 (PST) Received: from rocinante ([95.155.85.46]) by smtp.gmail.com with ESMTPSA id k20sm14217369pfc.83.2021.11.07.17.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Nov 2021 17:34:26 -0800 (PST) Date: Mon, 8 Nov 2021 02:34:13 +0100 From: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= To: Christophe JAILLET Cc: nsaenz@kernel.org, jim2101024@gmail.com, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, lorenzo.pieralisi@arm.com, robh@kernel.org, bhelgaas@google.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] PCI: brcmstb: Declare a bitmap as a bitmap, not as a plain 'unsigned long' Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christophe! [...] > This bitmap can be BRCM_INT_PCI_MSI_LEGACY_NR or BRCM_INT_PCI_MSI_NR long. Ahh. OK. Given this an option would be to: do nothing (keep current status quo); allocate memory dynamically passing the "msi->nr" after it has been set accordingly; use BRCM_INT_PCI_MSI_NR and waste a little bit of space. Perhaps moving to using the DECLARE_BITMAP() would be fine in this case too, at least to match style of other drivers more closely. Jim, Florian and Lorenzo - is this something that would be OK with you, or you would rather keep things as they were? > Addresses-Coverity: "Out-of-bounds access (ARRAY_VS_SINGLETON)" This tag would have to be written as: Addresses-Coverity: ("Out-of-bounds access (ARRAY_VS_SINGLETON)") [...] > + DECLARE_BITMAP (used, BRCM_INT_PCI_MSI_NR); Probably not the most elegant solution, but I would keep it as: DECLARE_BITMAP(used, BRCM_INT_PCI_MSI_NR); Otherwise aligning either before or after the open bracket will cause either an error or a warning issued by checkpatch.pl accordingly about the style. Other users of this (a vast majoirty) macro don't do any specific alignment at large [...] > + /* > + * Sanity check to make sure that the 'used' bitmap in struct brcm_msi > + * is large enough. > + */ > + BUILD_BUG_ON(BRCM_INT_PCI_MSI_LEGACY_NR > BRCM_INT_PCI_MSI_NR); A healthy paranoia, I see. :-) Krzysztof From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E376DC433F5 for ; Mon, 8 Nov 2021 01:35:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A7BD36120A for ; Mon, 8 Nov 2021 01:35:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A7BD36120A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UO1r7Dnt14+hiOh/gc3amPYQ7rMnGHA44k04W63xyTk=; b=PcqB4I/TunfMOC ftzDpWUwfZZgn+aU5nzff5zZHtk4kMczg+odS07ZJqdhYsERw3aYEXXg29MCIVF0wjTlLik5e1HZB BVyAiwMC6jI8qDrE+XDc32tNMRJ401KR5CZJiusMPyr2c7aT+x/aE7It2/VCna2YTx7n9OIlOzsJ/ lDf8MtgXT7VgARrhsBPZD88yal3cbnnSc+uySj6aFnPac9vD5D7bcfriHyNwsoCNjp7mS7kFaBv0y G1b8OCLgmjHURPsF8vgSAKBSuk5HXgQvvRpMS/zvNfb2eiWAkLFfifeE7vsjEwCVnG4HZmy7vctO9 E/a8hvLYTBsYzFa1VazA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mjtYO-00FFS9-8V; Mon, 08 Nov 2021 01:34:32 +0000 Received: from mail-pf1-f181.google.com ([209.85.210.181]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mjtYJ-00FFR5-Lf; Mon, 08 Nov 2021 01:34:28 +0000 Received: by mail-pf1-f181.google.com with SMTP id n85so9978732pfd.10; Sun, 07 Nov 2021 17:34:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mWr9Mi5YMHTa3T07Gk34FemQhAzXo7wj/0HuBoS0oBY=; b=kRfcTWRiFbmsff9cvG6zfEv49Xga5tHW1lpYDhToq5NZF+sHkQT2++VanJF2/sg3bp TrOiN9lNDyMX88FxvOSzORIWSoUVD+mbtfULshxN3fFUUISLTCI6eqbyi9HAQA/v62nP NLrcBHTDxSTDnqHMwwq4i9t3yGmWBMdtHI+oCT3z+Hyr1tuyM4IEdfo9BpmsEf0gLEv3 WSewkAIx2pJ3B33lnm+AZBWFk+wEY6Z8f2+YOIzXrAkrRjb46dvIgTKjrS9efP11/iC3 YO7Vn3pegwYNQ4HRW5W7oGQcq2WlBu7qulQM9rCVgalzo0PcM2mnq5MaL3yfDxhJccSJ 2NIQ== X-Gm-Message-State: AOAM533ffCmiIx290mzHFuaNyBsXQOWMJ6Rx6n0soG6k9KknCExka9/L JfKQ+QWhqc0rShc1JsYymG0= X-Google-Smtp-Source: ABdhPJyvrldzJctNqWP3qBig1k4nT4bAAzfVHptACo0tnM9HY/IvC+DM5RmBWCI0a12eDwKJDoZ1KQ== X-Received: by 2002:a62:7f4a:0:b0:44d:292f:cc24 with SMTP id a71-20020a627f4a000000b0044d292fcc24mr77899278pfd.58.1636335266915; Sun, 07 Nov 2021 17:34:26 -0800 (PST) Received: from rocinante ([95.155.85.46]) by smtp.gmail.com with ESMTPSA id k20sm14217369pfc.83.2021.11.07.17.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Nov 2021 17:34:26 -0800 (PST) Date: Mon, 8 Nov 2021 02:34:13 +0100 From: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= To: Christophe JAILLET Cc: nsaenz@kernel.org, jim2101024@gmail.com, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, lorenzo.pieralisi@arm.com, robh@kernel.org, bhelgaas@google.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] PCI: brcmstb: Declare a bitmap as a bitmap, not as a plain 'unsigned long' Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211107_173427_737900_98D1AE2C X-CRM114-Status: GOOD ( 13.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Christophe! [...] > This bitmap can be BRCM_INT_PCI_MSI_LEGACY_NR or BRCM_INT_PCI_MSI_NR long. Ahh. OK. Given this an option would be to: do nothing (keep current status quo); allocate memory dynamically passing the "msi->nr" after it has been set accordingly; use BRCM_INT_PCI_MSI_NR and waste a little bit of space. Perhaps moving to using the DECLARE_BITMAP() would be fine in this case too, at least to match style of other drivers more closely. Jim, Florian and Lorenzo - is this something that would be OK with you, or you would rather keep things as they were? > Addresses-Coverity: "Out-of-bounds access (ARRAY_VS_SINGLETON)" This tag would have to be written as: Addresses-Coverity: ("Out-of-bounds access (ARRAY_VS_SINGLETON)") [...] > + DECLARE_BITMAP (used, BRCM_INT_PCI_MSI_NR); Probably not the most elegant solution, but I would keep it as: DECLARE_BITMAP(used, BRCM_INT_PCI_MSI_NR); Otherwise aligning either before or after the open bracket will cause either an error or a warning issued by checkpatch.pl accordingly about the style. Other users of this (a vast majoirty) macro don't do any specific alignment at large [...] > + /* > + * Sanity check to make sure that the 'used' bitmap in struct brcm_msi > + * is large enough. > + */ > + BUILD_BUG_ON(BRCM_INT_PCI_MSI_LEGACY_NR > BRCM_INT_PCI_MSI_NR); A healthy paranoia, I see. :-) Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel