Re: [Linuxptp-devel] [PATCH 10/11] synce4l: add synce_transport interface
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Michalik, M. <mic...@in...> - 2022-05-04 14:00:43
|
Hello Miroslav, Much thanks for your review. > On Mon, May 02, 2022 at 11:06:04AM +0200, Arkadiusz Kubalewski wrote: > > Interface is used to create and store an opened socket for sending and > > receiving SyncE PDU's on a given NIC interface. > > > +++ b/synce_transport.c > > > +struct synce_transport *synce_transport_create(const char *iface) > > +{ > ... > > + if (strnlen(iface, IFNAMSIZ) == IFNAMSIZ) { > > + pr_err("interface name too long"); > > + goto err; > > + } > > + strncpy(transport->iface, iface, > > + (sizeof(transport->iface)/sizeof(*transport->iface))); > > That division looks odd here as strncpy works with chars. > > Anyway, this code seems to be confusing the compiler, assuming it can > produce an unterminated string, so maybe just use > "if (snprintf(...) >= IFNAMSIZ)" instead of strnlen() + strncpy()? > That is a great suggestion - thanks for it. We will update it in next version. > -- > Miroslav Lichvar > |