mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Stefano Manni <stefano.manni@gmail.com>
Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: mcp795: remove VLA usage
Date: Tue, 13 Mar 2018 00:31:02 +0100	[thread overview]
Message-ID: <20180312233102.GE3795@piout.net> (raw)
In-Reply-To: <20180312231338.3756-1-stefano.manni@gmail.com>

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

  reply	other threads:[~2018-03-12 23:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12 23:13 Stefano Manni
2018-03-12 23:31 ` Alexandre Belloni [this message]
2018-03-13  8:29   ` Stefano Manni
2018-03-13 16:28     ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180312233102.GE3795@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=stefano.manni@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®