From patchwork Tue Oct 12 10:30:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Guang X-Patchwork-Id: 1539708 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=L/QgD50s; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=cay2mDEn; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HTBlp5vSxz9sNH for ; Tue, 12 Oct 2021 21:31:18 +1100 (AEDT) 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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=6WgMvhgKlbKKE8jCZhpfgO6cd6Jx/vKKwJV6gyLhJAM=; b=L/QgD50ss48Vwl R+Ck7GeSBmJhz8MFO1tmTqCa7+F6bSoOgNgpxtAnpVojdF2LQsdB1u8eSzdU7RfnXgCWU23NHIBD9 MgGsxYRir7sqfT9v/WFmzLLbcSiGRXX1MYH5PGxB3/n+3q0VdU3qLFc776EgP2UAn7siSwcqqHmdL 8mfh/dy3CQLqPjOpuMb1Bm/eqW++bK097vpWlradIn9dV8szgp+gTM///Brd8zKmHpZE04F/K04aJ PvU9FJs8Ze4HY+3KVkkIXR+q3GgmbWLYrvRP1XN0CixU43uHoqjS3xFXWIWbCHrDtSAcOHWl+ittt KIm8HNZAHI3di2ADAmVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1maF3y-00CRLC-By; Tue, 12 Oct 2021 10:31:14 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1maF3v-00CRJp-Cl for linux-um@lists.infradead.org; Tue, 12 Oct 2021 10:31:12 +0000 Received: by mail-pg1-x534.google.com with SMTP id g184so13472159pgc.6 for ; Tue, 12 Oct 2021 03:31:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XFRE6Bw9U0FK+/TVlHf7B4gQZar5gd2qmpobG4wuOnE=; b=cay2mDEnvb5Pw9txoCqgxuPX2/AbUYjjoDe0XpjcWPWq7YXi73UZbBZEVMTjF5TwWI +Fn728JjUq1aweq8Yt6KCEaPyC96DoTB2XKn1r47X/V4WPN5hoTmrV8oYNXGolg32xaJ pwOZegLtnl7QDuEG570DBYNuXv9Ja7CS3gS2bvMfXApMLjyyADRK/8SVft02GAKOJP2z S3RNv4Tu6b67s7c+PJj8FzfHkcIszlaqxQLjJQA8gAzAfYexu0QTsDomYMsxPh86ZF/D 0nHw5feh42HDizIHVdE40U3yC/UIUbvGzMiLVv/7GtmgcF9CpsRFVsFz3U1yJZgkyd0m WmmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XFRE6Bw9U0FK+/TVlHf7B4gQZar5gd2qmpobG4wuOnE=; b=cretgSO2Icula935zANdFXYHIkyx0kSmLMkMIHhTOD03GbmtwTbFNKb7BG8tteSCIk 42Ndw4YFOLQEXMOEHHsf2/SS0zIByF4qkCpqJQ5gd2h2GdRnnBKsG2whuArhbmwFcjOp osC0G/wHq841aJ3q1NwcMLvfEnDXjQihl03RrzEqSPMU8vHZV4Y7msLArrhUHx24ZBB0 Y7Gcj6LFL4/g62Dx41NZuPP7cRSrVfyhVS3HR+H4TY6wCGnX4fR77KH9rJoTDnS4CgX7 qihisImcAM8nWDSwD8TPc+wfP8PzS1Qat0aVGhnl5asH9yuh9h9/9GwNtVy9nNPc1IvA RuEw== X-Gm-Message-State: AOAM530D2P+V3ryjzE+ac+VoSDb5HUBuqi7SclUXC5Ziedy/yUVrXgeq YxYS0g1IWQIlCzrtfToYKJA= X-Google-Smtp-Source: ABdhPJyJoPR9zrjOwp3+6krQT3bbg0nGZvxo0E2E67Pxvjm0iSIZOkRBaCGGkC6Zh9oXyTqdpEcs/w== X-Received: by 2002:a63:f30c:: with SMTP id l12mr22195219pgh.360.1634034670250; Tue, 12 Oct 2021 03:31:10 -0700 (PDT) Received: from debian11-dev-61.localdomain (192.243.120.180.16clouds.com. [192.243.120.180]) by smtp.gmail.com with ESMTPSA id x13sm11207484pgt.80.2021.10.12.03.31.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 03:31:09 -0700 (PDT) From: davidcomponentone@gmail.com To: jdike@addtoit.com Cc: joe@perches.com, richard@nod.at, anton.ivanov@cambridgegreys.com, johannes.berg@intel.com, davidcomponentone@gmail.com, linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, Zeal Robot Subject: [PATCH v3] Fix application of sizeof to pointer Date: Tue, 12 Oct 2021 18:30:54 +0800 Message-Id: X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211012_033111_459540_FC254BAE X-CRM114-Status: GOOD ( 11.16 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: David Yang The coccinelle check report: "./arch/um/drivers/virt-pci.c:192:20-26: ERROR: application of sizeof to pointer" Using the "sizeof(buf->data)" to fix it. Reported-by: Zeal Robot Signed-off-by: David Yang --- arch/um/drivers/virt-pci.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:534 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [davidcomponentone[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: David Yang The coccinelle check report: "./arch/um/drivers/virt-pci.c:192:20-26: ERROR: application of sizeof to pointer" Using the "sizeof(buf->data)" to fix it. Reported-by: Zeal Robot Signed-off-by: David Yang --- arch/um/drivers/virt-pci.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/um/drivers/virt-pci.c b/arch/um/drivers/virt-pci.c index c08066633023..148fa7a15ee0 100644 --- a/arch/um/drivers/virt-pci.c +++ b/arch/um/drivers/virt-pci.c @@ -180,16 +180,14 @@ static unsigned long um_pci_cfgspace_read(void *priv, unsigned int offset, }; /* buf->data is maximum size - we may only use parts of it */ struct um_pci_message_buffer *buf; - u8 *data; unsigned long ret = ~0ULL; if (!dev) return ~0ULL; buf = get_cpu_var(um_pci_msg_bufs); - data = buf->data; - memset(data, 0xff, sizeof(data)); + memset(buf->data, 0xff, sizeof(buf->data)); switch (size) { case 1: @@ -204,22 +202,22 @@ static unsigned long um_pci_cfgspace_read(void *priv, unsigned int offset, goto out; } - if (um_pci_send_cmd(dev, &hdr, sizeof(hdr), NULL, 0, data, 8)) + if (um_pci_send_cmd(dev, &hdr, sizeof(hdr), NULL, 0, buf->data, 8)) goto out; switch (size) { case 1: - ret = data[0]; + ret = buf->data[0]; break; case 2: - ret = le16_to_cpup((void *)data); + ret = le16_to_cpup((void *)buf->data); break; case 4: - ret = le32_to_cpup((void *)data); + ret = le32_to_cpup((void *)buf->data); break; #ifdef CONFIG_64BIT case 8: - ret = le64_to_cpup((void *)data); + ret = le64_to_cpup((void *)buf->data); break; #endif default: