[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250218-daring-melodic-meerkat-3f5953-mkl@pengutronix.de>
Date: Tue, 18 Feb 2025 15:27:40 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Cc: Matt Jan <zoo868e@...il.com>,
syzbot+d7d8c418e8317899e88c@...kaller.appspotmail.com, linux-kernel@...r.kernel.org, linux-can@...r.kernel.org
Subject: Re: [PATCH] can: ucan: Correct the size parameter
On 18.02.2025 23:26:01, Vincent Mailhol wrote:
> >> @@ -1555,7 +1544,10 @@ static int ucan_probe(struct usb_interface *intf,
> >>
> >> /* initialisation complete, log device info */
> >> netdev_info(up->netdev, "registered device\n");
> >> - netdev_info(up->netdev, "firmware string: %s\n", firmware_str);
> >> + ucan_get_fw_info(up, up->ctl_msg_buffer->fw_info,
> >> + sizeof(up->ctl_msg_buffer->fw_info));
> >> + netdev_info(up->netdev, "firmware string: %s\n",
> >> + up->ctl_msg_buffer->fw_info);
> >
> > We could also use the:
> >
> > printf("%.*s", sizeof(up->ctl_msg_buffer->fw_info), up->ctl_msg_buffer->fw_info);
> >
> > format string trick to only print a limited number of chars of the given
> > string.
>
> Indeed. But after the renaming of ucan_device_request_in() into
> ucan_get_fw_info(), it makes slightly more sense to me to have this new
> function to handle the string NUL termination logic rather than to
> deffer it to the format string.
ACK, makes sense!
> But thanks for the suggestion.
>
> > But I'm also fine with your solution. Either way, please send a
> > proper patch :)
>
> Will do so right now!
Thanks,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists