[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] hw/misc: Avoid sprintf() in the imx devices
From: |
Peter Maydell |
Subject: |
Re: [PATCH] hw/misc: Avoid sprintf() in the imx devices |
Date: |
Thu, 11 Apr 2024 11:46:55 +0100 |
On Thu, 11 Apr 2024 at 11:45, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> Various imx devices in hw/misc have a pattern in the
> debug logging where a function which prints register names
> has a fallback case for an unknown offset that uses sprintf().
> Use snprintf() instead to avoid warnings on macos. (The
> buffer could never overflow because it is 20 bytes and we
> will write at most 10 digits plus 4 nondigits plus NUL.)
>
> Commit created with:
>
> sed -i -e 's/sprintf(unknown/snprintf(unknown, sizeof(unknown)/' hw/misc/imx*
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Philippe: here's an easy sprintf->snprintf conversion for your pile :-)
Never mind, I hadn't noticed you'd sent a second patchset on
the sprintf issue, and you've already covered this one.
-- PMM