[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWhRULedk1GCav+8=DMc9OqKTtuaG1XHNqxurF9S=s18w@mail.gmail.com>
Date: Wed, 26 Jan 2022 13:46:48 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Marc Kleine-Budde <mkl@...gutronix.de>
Cc: Ulrich Hecht <uli+renesas@...nd.eu>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
netdev <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>, linux-can@...r.kernel.org,
"Lad, Prabhakar" <prabhakar.mahadev-lad.rj@...renesas.com>,
Biju Das <biju.das.jz@...renesas.com>,
Wolfram Sang <wsa@...nel.org>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
Wolfgang Grandegger <wg@...ndegger.com>,
Jakub Kicinski <kuba@...nel.org>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
socketcan@...tkopp.net,
Kieran Bingham <kieran.bingham@...asonboard.com>
Subject: Re: [PATCH v2 2/5] can: rcar_canfd: Add support for r8a779a0 SoC
Hi Marc,
On Wed, Jan 12, 2022 at 7:43 PM Marc Kleine-Budde <mkl@...gutronix.de> wrote:
> On 11.01.2022 17:22:28, Ulrich Hecht wrote:
> > Adds support for the CANFD IP variant in the V3U SoC.
> >
> > Differences to controllers in other SoCs are limited to an increase in
> > the number of channels from two to eight, an absence of dedicated
> > registers for "classic" CAN mode, and a number of differences in magic
> > numbers (register offsets and layouts).
> >
> > Inspired by BSP patch by Kazuya Mizuguchi.
> >
> > Signed-off-by: Ulrich Hecht <uli+renesas@...nd.eu>
> > --- a/drivers/net/can/rcar/rcar_canfd.c
> > +++ b/drivers/net/can/rcar/rcar_canfd.c
> > - of_child = of_get_child_by_name(pdev->dev.of_node, "channel1");
> > - if (of_child && of_device_is_available(of_child))
> > - channels_mask |= BIT(1); /* Channel 1 */
> > + strcpy(name, "channelX");
>
> please use strlcpy()
Why? To cause a silent failure instead of a possible crash, in the unlikely
case the buffer is shrinked or the string is enlarged?
What about preinitializing it at declaration time instead:
char name[9] = "channelX";
?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists