lkml.org 
[lkml]   [2021]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ALSA: hda/realtek: fix flexible_array.cocci warning
On Thu, 04 Nov 2021 08:59:41 +0100,
Guo Zhengkui wrote:
>
> Fix following coccicheck warnings:
> ./sound/pci/hda/patch_realtek.c:128:4-24: WARNING use
> flexible-array member instead.
>
> There is a regular need in the kernel to provide a way
> to declare having a dynamically sized set of trailing
> elements in a structure. Kernel code should always use
> “flexible array members” for these cases. The older style
> of one-element or zero-length arrays should no longer be used.
>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>

It's a false positive. That is no flexible array but really an array
of the size 1. It's written in that way so that you can extend more
members in future in case other keys needed.


thanks,

Takashi

> ---
> sound/pci/hda/patch_realtek.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 6322fac9e694..7935c363092e 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -125,7 +125,7 @@ struct alc_spec {
> unsigned int pll_coef_idx, pll_coef_bit;
> unsigned int coef0;
> struct input_dev *kb_dev;
> - u8 alc_mute_keycode_map[1];
> + u8 alc_mute_keycode_map[];
> };
>
> /*
> --
> 2.20.1
>

\
 
 \ /
  Last update: 2021-11-04 09:15    [W:0.028 / U:2.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site