Re: [PATCH net-next v2 4/5] netconsole: use netpoll_parse_ip_addr in local_ip_store
From: Breno Leitao
Date: Wed Jul 23 2025 - 11:15:03 EST
Hello Simon
On Wed, Jul 23, 2025 at 03:54:00PM +0100, Simon Horman wrote:
> > @@ -759,23 +760,10 @@ static ssize_t local_ip_store(struct config_item *item, const char *buf,
> > goto out_unlock;
> > }
> >
> > - if (strnchr(buf, count, ':')) {
> > - const char *end;
> > -
> > - if (in6_pton(buf, count, nt->np.local_ip.in6.s6_addr, -1, &end) > 0) {
> > - if (*end && *end != '\n') {
> > - pr_err("invalid IPv6 address at: <%c>\n", *end);
> > - goto out_unlock;
> > - }
> > - nt->np.ipv6 = true;
> > - } else
> > - goto out_unlock;
> > - } else {
> > - if (!nt->np.ipv6)
> > - nt->np.local_ip.ip = in_aton(buf);
> > - else
> > - goto out_unlock;
> > - }
> > + ipv6 = netpoll_parse_ip_addr(buf, &nt->np.local_ip);
> > + if (ipv6 == -1)
> > + goto out_unlock;
> > + nt->np.ipv6 = ipv6;
>
> I don't think this needs to block progress.
> And if you disagree that is fine too.
> But I would have expressed this as:
>
> nt->np.ipv6 = !!ipv6;
>
> Because nt->np.ipv6 is a bool and ipv6 is an int.
>
> Likewise for patch 5/5.
Agree with the suggestion. I will update the patchset with your
suggestion.
Thank you very much for your review, again!
--breno