LoongArch: use flexible-array member instead of zero-length array

Message ID 20221018094742.324576-1-zys.zljxml@gmail.com
State New
Headers
Series LoongArch: use flexible-array member instead of zero-length array |

Commit Message

Katrin Jo Oct. 18, 2022, 9:47 a.m. UTC
  From: Yushan Zhou <katrinzhou@tencent.com>

Eliminate the following coccicheck warning:
./arch/loongarch/include/asm/ptrace.h:32:15-21: WARNING use flexible-array member instead

Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
---
 arch/loongarch/include/asm/ptrace.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

WANG Xuerui Oct. 18, 2022, 12:27 p.m. UTC | #1
On 2022/10/18 17:47, zys.zljxml@gmail.com wrote:
> From: Yushan Zhou <katrinzhou@tencent.com>
> 
> Eliminate the following coccicheck warning:
> ./arch/loongarch/include/asm/ptrace.h:32:15-21: WARNING use flexible-array member instead
> 
> Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
> ---
>   arch/loongarch/include/asm/ptrace.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/loongarch/include/asm/ptrace.h b/arch/loongarch/include/asm/ptrace.h
> index 17838c6b7ccd..7437b9366c3b 100644
> --- a/arch/loongarch/include/asm/ptrace.h
> +++ b/arch/loongarch/include/asm/ptrace.h
> @@ -29,7 +29,7 @@ struct pt_regs {
>   	unsigned long csr_euen;
>   	unsigned long csr_ecfg;
>   	unsigned long csr_estat;
> -	unsigned long __last[0];
> +	unsigned long __last[];
>   } __aligned(8);
>   
>   static inline int regs_irqs_disabled(struct pt_regs *regs)

Seems good. Thanks.

Reviewed-by: WANG Xuerui <git@xen0n.name>
  
Huacai Chen Oct. 18, 2022, 12:40 p.m. UTC | #2
Queued for loongarch-fixes

On Tue, Oct 18, 2022 at 8:27 PM WANG Xuerui <kernel@xen0n.name> wrote:
>
> On 2022/10/18 17:47, zys.zljxml@gmail.com wrote:
> > From: Yushan Zhou <katrinzhou@tencent.com>
> >
> > Eliminate the following coccicheck warning:
> > ./arch/loongarch/include/asm/ptrace.h:32:15-21: WARNING use flexible-array member instead
> >
> > Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
> > ---
> >   arch/loongarch/include/asm/ptrace.h | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/loongarch/include/asm/ptrace.h b/arch/loongarch/include/asm/ptrace.h
> > index 17838c6b7ccd..7437b9366c3b 100644
> > --- a/arch/loongarch/include/asm/ptrace.h
> > +++ b/arch/loongarch/include/asm/ptrace.h
> > @@ -29,7 +29,7 @@ struct pt_regs {
> >       unsigned long csr_euen;
> >       unsigned long csr_ecfg;
> >       unsigned long csr_estat;
> > -     unsigned long __last[0];
> > +     unsigned long __last[];
> >   } __aligned(8);
> >
> >   static inline int regs_irqs_disabled(struct pt_regs *regs)
>
> Seems good. Thanks.
>
> Reviewed-by: WANG Xuerui <git@xen0n.name>
>
> --
> WANG "xen0n" Xuerui
>
> Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
>
>
  

Patch

diff --git a/arch/loongarch/include/asm/ptrace.h b/arch/loongarch/include/asm/ptrace.h
index 17838c6b7ccd..7437b9366c3b 100644
--- a/arch/loongarch/include/asm/ptrace.h
+++ b/arch/loongarch/include/asm/ptrace.h
@@ -29,7 +29,7 @@  struct pt_regs {
 	unsigned long csr_euen;
 	unsigned long csr_ecfg;
 	unsigned long csr_estat;
-	unsigned long __last[0];
+	unsigned long __last[];
 } __aligned(8);
 
 static inline int regs_irqs_disabled(struct pt_regs *regs)