[PATCH v2 04/19] net/xsc: add xsc device init and uninit
WanRenyong
wanry at yunsilicon.com
Thu Sep 12 05:58:00 CEST 2024
On 2024/9/11 11:47, Stephen Hemminger wrote:
> On Wed, 11 Sep 2024 10:07:25 +0800
> "WanRenyong" <wanry at yunsilicon.com> wrote:
>
>> +
>> + sprintf(path, "%s/device/uevent", dev_path);
> better to use snprintf for safety
OK, will fix it in next version.
>> + while (fgets(line, sizeof(line), file) == line) {
>> + size_t len = strlen(line);
>> +
>> + /* Truncate long lines. */
>> + if (len == (sizeof(line) - 1)) {
>> + while (line[(len - 1)] != '\n') {
>> + int n = fgetc(file);
>> +
>> + if (n == EOF)
>> + goto out;
>> + line[(len - 1)] = n;
>> + }
>> + /* No match for long lines. */
>> + continue;
>> + }
> If you have to deal with long lines better to use something
> like getline() that handles arbitrary length.
I will think about it.
Hello Stephen,
Thanks for your review, my reply please see above.
--
Thanks,
WanRenyong
More information about the dev
mailing list