lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230814-void-sound-soc-codecs-rt5677-v1-1-5c468c60fa37@google.com>
Date:   Mon, 14 Aug 2023 21:58:56 +0000
From:   Justin Stitt <justinstitt@...gle.com>
To:     Oder Chiou <oder_chiou@...ltek.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>
Cc:     alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
        Nathan Chancellor <nathan@...nel.org>,
        Justin Stitt <justinstitt@...gle.com>
Subject: [PATCH] ASoC: rt5677: fix -Wvoid-pointer-to-enum-cast warning

`match_id->data` is a void* and as such is being truncated when cast to
`enum rt5677_type` which is only int-width.

There is likely no data loss occurring, though, as `enum rt5677_type`
consists of only two fields from 0 to 1 wherein obviously no data loss
happens from pointer-width -> int-width.

Link: https://github.com/ClangBuiltLinux/linux/issues/1910
Reported-by: Nathan Chancellor <nathan@...nel.org>
Signed-off-by: Justin Stitt <justinstitt@...gle.com>
---
Note: I'm not sure if `uintptr_t` is the correct solution here as I've
also seen a cast to `unsigned long` suffice. Any thoughts on the
semantically correct option?
---
 sound/soc/codecs/rt5677.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index ad14d18860fc..278cb0b265e5 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -5578,7 +5578,7 @@ static int rt5677_i2c_probe(struct i2c_client *i2c)
 
 		match_id = of_match_device(rt5677_of_match, &i2c->dev);
 		if (match_id)
-			rt5677->type = (enum rt5677_type)match_id->data;
+			rt5677->type = (uintptr_t)match_id->data;
 	} else if (ACPI_HANDLE(&i2c->dev)) {
 		const struct acpi_device_id *acpi_id;
 

---
base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
change-id: 20230814-void-sound-soc-codecs-rt5677-dfc041c1a734

Best regards,
--
Justin Stitt <justinstitt@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ