Re: [PATCH] soc: fsl: qe: Replace one-element array and use struct_size() helper

2020-05-26 Thread Li Yang
> > moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE > > ; lkml ; > > Gustavo A. R. Silva > > Subject: Re: [PATCH] soc: fsl: qe: Replace one-element array and use > > struct_size() helper > > > > On Wed, May 20, 2020 at 10:24 PM Kees Cook > >

RE: [PATCH] soc: fsl: qe: Replace one-element array and use struct_size() helper

2020-05-24 Thread Qiang Zhao
A. R. Silva > Subject: Re: [PATCH] soc: fsl: qe: Replace one-element array and use > struct_size() helper > > On Wed, May 20, 2020 at 10:24 PM Kees Cook > wrote: > > > > On Wed, May 20, 2020 at 06:52:21PM -0500, Li Yang wrote: > > > On Mon, May 18, 2020 at 5:57 PM Ke

Re: [PATCH] soc: fsl: qe: Replace one-element array and use struct_size() helper

2020-05-22 Thread Li Yang
On Mon, May 18, 2020 at 5:16 PM Gustavo A. R. Silva wrote: > > The current codebase makes use of one-element arrays in the following > form: > > struct something { > int length; > u8 data[1]; > }; > > struct something *instance; > > instance = kmalloc(sizeof(*instance) + size, GFP_KERNEL);

Re: [PATCH] soc: fsl: qe: Replace one-element array and use struct_size() helper

2020-05-22 Thread Li Yang
On Wed, May 20, 2020 at 10:24 PM Kees Cook wrote: > > On Wed, May 20, 2020 at 06:52:21PM -0500, Li Yang wrote: > > On Mon, May 18, 2020 at 5:57 PM Kees Cook wrote: > > > Hm, looking at this code, I see a few other things that need to be > > > fixed: > > > > > > 1) drivers/tty/serial/ucc_uart.c do

Re: [PATCH] soc: fsl: qe: Replace one-element array and use struct_size() helper

2020-05-20 Thread Kees Cook
On Wed, May 20, 2020 at 06:52:21PM -0500, Li Yang wrote: > On Mon, May 18, 2020 at 5:57 PM Kees Cook wrote: > > Hm, looking at this code, I see a few other things that need to be > > fixed: > > > > 1) drivers/tty/serial/ucc_uart.c does not do a be32_to_cpu() conversion > >on the length test (u

Re: [PATCH] soc: fsl: qe: Replace one-element array and use struct_size() helper

2020-05-20 Thread Gustavo A. R. Silva
On Wed, May 20, 2020 at 06:52:21PM -0500, Li Yang wrote: > On Mon, May 18, 2020 at 5:57 PM Kees Cook wrote: > > > > On Mon, May 18, 2020 at 05:19:04PM -0500, Gustavo A. R. Silva wrote: > > > The current codebase makes use of one-element arrays in the following > > > form: > > > > > > struct someth

Re: [PATCH] soc: fsl: qe: Replace one-element array and use struct_size() helper

2020-05-20 Thread Li Yang
On Mon, May 18, 2020 at 5:57 PM Kees Cook wrote: > > On Mon, May 18, 2020 at 05:19:04PM -0500, Gustavo A. R. Silva wrote: > > The current codebase makes use of one-element arrays in the following > > form: > > > > struct something { > > int length; > > u8 data[1]; > > }; > > > > struct som

RE: [PATCH] soc: fsl: qe: Replace one-element array and use struct_size() helper

2020-05-18 Thread Qiang Zhao
ilva ; > Kees Cook > Subject: [PATCH] soc: fsl: qe: Replace one-element array and use struct_size() > helper > > The current codebase makes use of one-element arrays in the following > form: > > struct something { > int length; > u8 data[1]; > }; >

Re: [PATCH] soc: fsl: qe: Replace one-element array and use struct_size() helper

2020-05-18 Thread Kees Cook
On Mon, May 18, 2020 at 05:19:04PM -0500, Gustavo A. R. Silva wrote: > The current codebase makes use of one-element arrays in the following > form: > > struct something { > int length; > u8 data[1]; > }; > > struct something *instance; > > instance = kmalloc(sizeof(*instance) + size, GF

[PATCH] soc: fsl: qe: Replace one-element array and use struct_size() helper

2020-05-18 Thread Gustavo A. R. Silva
The current codebase makes use of one-element arrays in the following form: struct something { int length; u8 data[1]; }; struct something *instance; instance = kmalloc(sizeof(*instance) + size, GFP_KERNEL); instance->length = size; memcpy(instance->data, source, size); but the preferre