All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] ALSA: sc6000: Fix incorrect sizeof operator
@ 2021-07-20 16:17 Colin King
  2021-07-20 16:22   ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2021-07-20 16:17 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, alsa-devel; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Static analysis is warning that the sizeof being used is should be
of *vport and not vport. Although these are the same size it is not
a portable assumption to assume this is true for all cases.  Fix this
by using sizeof(*vport).

Addresses-Coverity: ("Sizeof not portable")
Fixes: 111601ff76e9 ("ALSA: sc6000: Allocate resources with device-managed APIs")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/isa/sc6000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index 6236c4fa766a..44c05b55fc15 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -552,7 +552,7 @@ static int snd_sc6000_probe(struct device *devptr, unsigned int dev)
 
 
 	err = snd_devm_card_new(devptr, index[dev], id[dev], THIS_MODULE,
-				sizeof(vport), &card);
+				sizeof(*vport), &card);
 	if (err < 0)
 		return err;
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] ALSA: sc6000: Fix incorrect sizeof operator
  2021-07-20 16:17 [PATCH][next] ALSA: sc6000: Fix incorrect sizeof operator Colin King
@ 2021-07-20 16:22   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2021-07-20 16:22 UTC (permalink / raw)
  To: Colin King
  Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, kernel-janitors, linux-kernel

On Tue, 20 Jul 2021 18:17:07 +0200,
Colin King wrote:
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> Static analysis is warning that the sizeof being used is should be
> of *vport and not vport. Although these are the same size it is not
> a portable assumption to assume this is true for all cases.  Fix this
> by using sizeof(*vport).
> 
> Addresses-Coverity: ("Sizeof not portable")
> Fixes: 111601ff76e9 ("ALSA: sc6000: Allocate resources with device-managed APIs")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks.  I have another patch to drop this allocation (it's just a
pointer, so no need for kmalloc, really), but since your patch is
correct, I'll rebase on yours.


Takashi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] ALSA: sc6000: Fix incorrect sizeof operator
@ 2021-07-20 16:22   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2021-07-20 16:22 UTC (permalink / raw)
  To: Colin King; +Cc: linux-kernel, alsa-devel, kernel-janitors, Takashi Iwai

On Tue, 20 Jul 2021 18:17:07 +0200,
Colin King wrote:
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> Static analysis is warning that the sizeof being used is should be
> of *vport and not vport. Although these are the same size it is not
> a portable assumption to assume this is true for all cases.  Fix this
> by using sizeof(*vport).
> 
> Addresses-Coverity: ("Sizeof not portable")
> Fixes: 111601ff76e9 ("ALSA: sc6000: Allocate resources with device-managed APIs")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks.  I have another patch to drop this allocation (it's just a
pointer, so no need for kmalloc, really), but since your patch is
correct, I'll rebase on yours.


Takashi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-20 16:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20 16:17 [PATCH][next] ALSA: sc6000: Fix incorrect sizeof operator Colin King
2021-07-20 16:22 ` Takashi Iwai
2021-07-20 16:22   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.