Re: [PATCH] netconsole: Append kernel version to message

From: Andrew Lunn
Date: Mon Jul 03 2023 - 12:46:43 EST


>
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
> Cc: Dave Jones <davej@xxxxxxxxxxxxxxxxx>

Signed-off-by should come last.

> +#ifdef CONFIG_NETCONSOLE_UNAME
> +static void send_ext_msg_udp_uname(struct netconsole_target *nt,
> + const char *msg, unsigned int len)
> +{
> + unsigned int newlen;
> + char *newmsg;
> + char *uname;
> +
> + uname = init_utsname()->release;
> +
> + newmsg = kasprintf(GFP_KERNEL, "%s;%s", uname, msg);
> + if (!newmsg)
> + /* In case of ENOMEM, just ignore this entry */
> + return;

Hi Breno

Why not just send the message without uname appended. You probably
want to see the OOM messages...

Also, what context are we in here? Should that be GFP_ATOMIC, which
net/core/netpoll.c is using to allocate the skbs?

> +static inline void send_msg_udp(struct netconsole_target *nt,
> + const char *msg, unsigned int len)
> +{
> +#ifdef CONFIG_NETCONSOLE_UNAME
> + send_ext_msg_udp_uname(nt, msg, len);
> +#else
> + send_ext_msg_udp(nt, msg, len);
> +#endif

Please use

if (IS_ENABLED(CONFIG_NETCONSOLE_UNAME)) {} else {}

so the code is compiled and then thrown away. That nakes build testing
more efficient.

Andrew