lkml.org 
[lkml]   [2018]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] rtc: mcp795: remove VLA usage
Hi,

On 13/03/2018 at 00:13:38 +0100, Stefano Manni wrote:
> In preparation to enabling -Wvla, remove VLAs and replace them with
> fixed-length arrays instead.
>
> rtc-mcp795.c uses a variable-length array declaration to contain
> the command to write the rtcc; this can be replaced by a fixed-
> size array of length 2 (instruction, address) + 32 (data out),
> assuming a maximum data length of 32 bytes before wrap up.
>
> This was prompted by https://lkml.org/lkml/2018/3/7/621
>
> Signed-off-by: Stefano Manni <stefano.manni@gmail.com>
> ---
> drivers/rtc/rtc-mcp795.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c
> index 77f21331ae21..a5f504e2364c 100644
> --- a/drivers/rtc/rtc-mcp795.c
> +++ b/drivers/rtc/rtc-mcp795.c
> @@ -61,6 +61,9 @@
>
> #define SEC_PER_DAY (24 * 60 * 60)
>
> +/* Maximum length for data out in write operation to RTCC */
> +#define MCP795_MAX_DATAOUT_LEN 32
> +

This is wrong, see https://marc.info/?l=linux-kernel&m=152046370320811&w=2

Also, https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next&id=74ce1a932504da166cfbccf5567aa3751b6aa599

--
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

\
 
 \ /
  Last update: 2018-03-13 00:32    [W:0.054 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site