From patchwork Tue Aug 15 21:11:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Stitt X-Patchwork-Id: 1821575 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.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=Xm5oZ/eM; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=DEykWB4V; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RQP8s2gfHz1yfS for ; Wed, 16 Aug 2023 07:11:55 +1000 (AEST) 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:Cc:To:From:Subject:Message-ID: Mime-Version:Date: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=eBX7kvkScCrYw/Jqn9ozwgWOCLOvtaptzkTXDNEV8oE=; b=Xm5 oZ/eM+bIuxt/DuW6nkCAjBWkzL6vPzmGmttKEMFWCaucBHMXUO/eU2COy+pTO8pLN5+DrWpO9eUxY hkjPce3lxFJS9BZYFGilHczIeyuT1DDCgRvXCIJIh/QGpTz7vg6TD7wTSOb5tn+BsjYmvTW5Ln5PC ilS3VsoR4TtKgZZ4XTU7ovoa+VFdI9sFWfZvW9ARBAX/g/FvGa8GDWQjz41UJJHaB+madLSxqdRIy JemBPZbS27EInCOWoxo1BAsENc+XL3ZNe1GoPqzd7HiAbNH/RHWv5Q9X+E/GusUJnZOr2eiGTNgar 0cCdm+Hznz0hUam8GVEawtpgOIrE+IA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qW1Jz-002VpZ-2p; Tue, 15 Aug 2023 21:11:23 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qW1Jw-002Vmy-11 for linux-mtd@lists.infradead.org; Tue, 15 Aug 2023 21:11:21 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-589ebdea23fso49927937b3.0 for ; Tue, 15 Aug 2023 14:11:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692133875; x=1692738675; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=3y6Izf6PWqeRPwTjJUSGtpHjQ5Xbrf4Hr6LZlxEahOk=; b=DEykWB4VPD0KGwkR1rgTEkxuGrmyMbRmPDZOUHEnPXwFaHI3rUqsojcqqySGFoopGa qtooGMRnC2iBatnU5WIMN05g0vZUnhEdJZVjk4lw6MaKHZj3uELr1pxCP5/hsgTqIrBu 1inqQgqIJZJ0VlbPAJIpm9/aWo9WsTqBaNDDVihJxzTBMBNgex/TOLHB2mYmoJOp1Kva bWeQr8NZbtkqjwq7mvqMAtaqjcOqkVBp/oDMzrZX7hqKYwQW4a6d2vnhTsoUk3GQCY2x 1lnjzzGiQr7G4wgDP1gxwsyDXBuhUnF7eiCe83f1an5ltuLTmcDWNx/do1f/T7qdFpLb btCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692133875; x=1692738675; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=3y6Izf6PWqeRPwTjJUSGtpHjQ5Xbrf4Hr6LZlxEahOk=; b=eR2bA0XLKSaT80fKP9u5m2X6+x51+5nChIvGEnr8WfA3RTUC/u545h1OGZYUA0uqcY pI+0qoHg59HjHwq+jj7SycItmawPihQhYzTY9srcoEOlja4JV+04JZ/nCEU0lWTPjPmr katRVgS/AgVmGyvQO9us91wYCsjtLInsmr13aigglPc/GgQPcxO4aFXxQGeRHZGfqkTY J+a9KUkyexJTLZ4u3nun1DQE+a7bwA6JOoCsjiMFkcMnhbLPnJOB6MfHsJCS/CA9se5T 17/TcSrlmx9D7a/kU7/n/IZEPQuQuXmOiHTffztPBc8+ZjL54rx3ksrRYAJi0MvRSUTd Y2Qw== X-Gm-Message-State: AOJu0YwJ5nHpZK2d7QQqxnlWeHct4TXtt3OGwiNNrfJzqRMRja4FNNZ8 xkLWo1bvgA2eDN0iXRHIz/68TgU+3DA5OZwVYg== X-Google-Smtp-Source: AGHT+IESHOcNCiS8o17qcx7V9DnY9/u5Ejmnxug8PTEedCECk+Qy3ouUC8CMmwLN9yzo20in9nO1So2V6LKsvaBvXA== X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5]) (user=justinstitt job=sendgmr) by 2002:a05:6902:1818:b0:d08:95:76d with SMTP id cf24-20020a056902181800b00d080095076dmr2170ybb.6.1692133875480; Tue, 15 Aug 2023 14:11:15 -0700 (PDT) Date: Tue, 15 Aug 2023 21:11:12 +0000 Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAO/p22QC/x2NQQrDMAwEvxJ0rsB2aVP6ldKDqeRG0CRGCibB5 O9xepuZw24FYxU2eHYVlIuYzFMTf+ngM8TpyyjUHIILV/fwNyyzEJJKYTUcF8IxZsM8bNYAzxo X+TGG0LvEfaLk79DWsnKS9f/0eu/7AWJszKR5AAAA X-Developer-Key: i=justinstitt@google.com; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE= X-Developer-Signature: v=1; a=ed25519-sha256; t=1692133874; l=1857; i=justinstitt@google.com; s=20230717; h=from:subject:message-id; bh=HWSTPugX/6hl45mOi43ekrd154LFJ7mP03sqOaFNygg=; b=mUKhNFxwaMYAvGE8r2mEXisjetzD1WuRCSRRz8uhoZeTBBafOwti17CqjOH6uuGZ7lX7yJ56h SfAxWxpgjWqCv3/V5qSm4hMKInmpums0ZWkx3xU6Pf+KbCoMPqB90qI X-Mailer: b4 0.12.3 Message-ID: <20230815-void-drivers-mtd-maps-physmap-versatile-v1-1-ba6fc86d5e4e@google.com> Subject: [PATCH] mtd: maps: fix -Wvoid-pointer-to-enum-cast warning From: Justin Stitt To: Linus Walleij , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Nathan Chancellor , Nick Desaulniers , Tom Rix Cc: linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Justin Stitt X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_141120_362605_35AA554A X-CRM114-Status: GOOD ( 12.32 ) X-Spam-Score: -7.7 (-------) 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: When building with clang 18 I see the following warning: | drivers/mtd/maps/physmap-versatile.c:209:25: warning: cast to smaller | integer type 'enum versatile_flashprot' from 'const void *' [-Wvoid-p [...] Content analysis details: (-7.7 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:114a 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 -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -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 -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When building with clang 18 I see the following warning: | drivers/mtd/maps/physmap-versatile.c:209:25: warning: cast to smaller | integer type 'enum versatile_flashprot' from 'const void *' [-Wvoid-pointer-to-enum-cast] | 209 | versatile_flashprot = (enum versatile_flashprot)devid->data; This is due to the fact that `devid->data` is a void* while `enum versatile_flashprot` has the size of an int. This leads to truncation and possible data loss. Link: https://github.com/ClangBuiltLinux/linux/issues/1910 Reported-by: Nathan Chancellor Signed-off-by: Justin Stitt --- Note: There is likely no data loss occurring here due to the fact that `enum versatile_flashprot` has only a few enumerated fields, none of which are large enough to cause data loss. Nonetheless, this patch helps towards the goal of eventually enabling this warning for more builds. Signed-off-by: Justin Stitt --- drivers/mtd/maps/physmap-versatile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421 change-id: 20230815-void-drivers-mtd-maps-physmap-versatile-2270fe7fdf16 Best regards, -- Justin Stitt diff --git a/drivers/mtd/maps/physmap-versatile.c b/drivers/mtd/maps/physmap-versatile.c index a1b8b7b25f88..d65cf8833771 100644 --- a/drivers/mtd/maps/physmap-versatile.c +++ b/drivers/mtd/maps/physmap-versatile.c @@ -206,7 +206,7 @@ int of_flash_probe_versatile(struct platform_device *pdev, if (!sysnp) return -ENODEV; - versatile_flashprot = (enum versatile_flashprot)devid->data; + versatile_flashprot = (uintptr_t)devid->data; rmap = syscon_node_to_regmap(sysnp); of_node_put(sysnp); if (IS_ERR(rmap))