[PATCH 1/2] vsprintf: fix missing break when printing %pJP

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Mar 25 09:58:02 PDT 2025


Hello Jules,

On 3/25/25 16:53, Jules Maselbas wrote:
> When the format `%pJP` was introduced the new switch case didn't had a
> break at the end, it was last case in the switch. However subsequent
> commit didn't add a break either, creating a potential fallthrough.
> Add the missing break.
> 
> Fixes: 107eeef8f2 ("vsprintf: add support for printing MAC addresses")
> Signed-off-by: Jules Maselbas <jmaselbas at zdiv.net>

Ouch, Good catch.

Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>

Thanks,
Ahmad

> ---
>  lib/vsprintf.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index f553662ce8..0656ba3620 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -561,6 +561,7 @@ static char *pointer(const char *fmt, char *buf, const char *end, const void *pt
>  	case 'J':
>  		if (fmt[1] == 'P' && IS_ENABLED(CONFIG_JSMN))
>  			return jsonpath_string(buf, end, ptr, field_width, precision, flags, fmt);
> +		break;
>          case 'M':
>  		/* Colon separated: 00:01:02:03:04:05 */
>  		return mac_address_string(buf, end, ptr, field_width, precision, flags, fmt);




More information about the barebox mailing list