Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp5146473rwe; Tue, 18 Apr 2023 02:45:20 -0700 (PDT) X-Google-Smtp-Source: AKy350YD33CgNnkWX4MbNp4bNOL3PJHH5J160usrSdRRmQO79TC/zAhvqLFIyNm18fpwC6wNpsSq X-Received: by 2002:a17:902:e743:b0:1a1:8fd4:251 with SMTP id p3-20020a170902e74300b001a18fd40251mr1842284plf.55.1681811120453; Tue, 18 Apr 2023 02:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681811120; cv=none; d=google.com; s=arc-20160816; b=Yrde7ULy6jAkihJ9dPj+vYQU/8EqNaQOWrwOkIANkjRmrkzEc1G7Vv9z8ITMaQAY0u GsB4Zf7aQptXryrrbDKbMYcXO9rSukFMNdIwBfPM4wpkC1cwXqJK2XRb88fZlG5R8uyF TfxczyaVKU9LzqpaoMMt+1505rI9rjj0UB6eylH1czkkEE+iQ//jhV1msHRdng+o1jpR GK1lU+4nCHFUG8nNWgjw2ntsJiLmfnCM+biqyrBupX74lUPyejQ/ZupgzVP4LMoGb5hr NXpZp/BYkA3xegjW4Ti7UywHi/Rreneo8Xa2eAmIGl/k6c4Nt6TxqqO7Rm6KHWA6NOJs 18Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zzQBmhBycWm3Z62ZlfZCa618OpeoVEJ5/aiYxN8jq8g=; b=dOQvpJWeVH/DmLsckpOPBXFTRpwZc7KIE5sKaDJL0RWMzwx5i2qpr1Q7bZnllyLzeS TaSwZGkAf564XDlR2U8TWLVakQ8pgqETllUIjslTIIc/48N+N2JdF/rCftcWvVzahUcZ nVYQ0zXhz3MBv6Thy/t7LA9pSJGjF5dT0Po+yPAHedQQPt45W0Lk3sAV0qmrTrnzPi6F XzsJ4zI1JPEqIFeUGy4OrLVcqF4cIkxtqmJDIzWVwzLLq/SZNj5ahUbcpMvtcHmgFbI2 dxAtY1G2m6bt3qLqSaN+XVLWiqshFQH+x/XVPzeUxuF6Xy2C+7mXW40bYNevht89cFiW 52Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Y8X8UNZ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw9-20020a170903044900b001a6cb6667f9si5773699plb.21.2023.04.18.02.45.06; Tue, 18 Apr 2023 02:45:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Y8X8UNZ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231307AbjDRJkt (ORCPT + 99 others); Tue, 18 Apr 2023 05:40:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231436AbjDRJkR (ORCPT ); Tue, 18 Apr 2023 05:40:17 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2107C7D84; Tue, 18 Apr 2023 02:39:59 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3f0a00a5880so14036885e9.0; Tue, 18 Apr 2023 02:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681810797; x=1684402797; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=zzQBmhBycWm3Z62ZlfZCa618OpeoVEJ5/aiYxN8jq8g=; b=Y8X8UNZ3w6OP7zNvJtK8S//kpaupljHwfXHt1s4mtjajbW+xW7UhtBZ06YIMp2AAu8 cq9xxNTjCkt7qUgqteV4MJ54oxoAbc7Tw82xsj5RIRtAbbEDygewA5bcaopcldsde0Ov LcEpUgVX6qf2/5Iq0q7bHGRtzsN3EBDdgH+jzCMfm6MaSeQljGUIxoPREBkehDCdSMFT fnHFsBDaw4lPYCU5ljyfN9q+DeRO3osc7bhUUM1eh6q/FMKY8e68Wsp8NV+cd9ykRC22 736BNbfhsW8wwYJ1Jls/UqzT+xI0UJjA7bvliZwnmfSI/Nh4Qcmfr7wpKBtgiXr6IthU EzpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681810797; x=1684402797; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zzQBmhBycWm3Z62ZlfZCa618OpeoVEJ5/aiYxN8jq8g=; b=lFG03HGy2BBXErV3uFHBGB3ECcncp48biwiVdGmB6S8NS3JrdylL/1CuVhbLJ5I0BE ErQjIjRN5TNTBEWklxmK4GgB5dExmZEFWKCniys/Lj8XJ9VrURy1XiS9jDDh25YrvwT2 rNl2DTSmb73vinbPjaz5QEnpdnrknrt3w6J3kC1atvZWGkMMyrspopmKswYr8Kwch4ZJ NzMmKKelF/dlL9LsIN3dcrk0PB1XPb9RRbVCskT96OnCow1Kt1AIsF4cO1i94Ozv6BSU z+7IouMTk9oixAVtu8hN7YD37zhtPzXNMoaLCteGODKLBKHlIfyUKJkdBBe6Cngw8rBT JCwg== X-Gm-Message-State: AAQBX9c+haF+PbpLxOi2AErFrhwOecBQQhkwj+r9GwSwgMuFFpLFd7l8 ohlVJy3zno171JzwuR37Mwo= X-Received: by 2002:adf:ea8b:0:b0:2f2:c46b:1eb5 with SMTP id s11-20020adfea8b000000b002f2c46b1eb5mr1491650wrm.59.1681810797486; Tue, 18 Apr 2023 02:39:57 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id m14-20020a056000008e00b002c71b4d476asm12576888wrx.106.2023.04.18.02.39.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 02:39:56 -0700 (PDT) Date: Tue, 18 Apr 2023 12:39:43 +0300 From: Dan Carpenter To: John Paul Adrian Glaubitz Cc: Christophe JAILLET , Yoshinori Sato , Rich Felker , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-sh@vger.kernel.org, Geert Uytterhoeven Subject: Re: [PATCH RESEND] sh: sq: Use the bitmap API when applicable Message-ID: <837e9f5e-ca8d-4c93-9a89-d7bdb9bb0240@kili.mountain> References: <071e9f32c19a007f4922903282c9121898641400.1681671848.git.christophe.jaillet@wanadoo.fr> <14788dbc-c2a6-4d1d-8ae3-1be53b0daf17@kili.mountain> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="V2iJ7csRRNqcDySa" Content-Disposition: inline In-Reply-To: <14788dbc-c2a6-4d1d-8ae3-1be53b0daf17@kili.mountain> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --V2iJ7csRRNqcDySa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Apr 18, 2023 at 10:30:01AM +0300, Dan Carpenter wrote: > I have some unpublished Smatch stuff which tries to track "variable x > is in terms of bit units or byte units etc." I will try to make a > static checker rule for this. Attached. It prints a warning like this: drivers/net/ethernet/broadcom/cnic.c:667 cnic_init_id_tbl() warn: allocating units of longs instead of bytes 'test_var' I'll test it out tonight. regards, dan carpenter --V2iJ7csRRNqcDySa Content-Type: text/x-csrc; charset=us-ascii Content-Disposition: attachment; filename="check_allocating_longs.c" /* * Copyright 2023 Linaro Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt */ #include "smatch.h" #include "smatch_slist.h" static int my_id; static void match_allocation(struct expression *expr, const char *name, struct symbol *sym, struct allocation_info *info) { struct smatch_state *units; char *str; units = get_units(info->total_size); if (!units || strcmp(units->name, "longs") != 0) return; str = expr_to_str(info->total_size); sm_warning("allocating units of longs instead of bytes '%s'", str); free_string(str); } void check_allocating_longs(int id) { my_id = id; add_allocation_hook(&match_allocation); } --V2iJ7csRRNqcDySa--