Re: [PATCH v2 07/24] serdev: Allows dynamic creation of devices via sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 11, 2018 at 2:52 PM, Ricardo Ribalda Delgado
<ricardo.ribalda@xxxxxxxxx> wrote:
> Allow creating and deleting devices via sysfs. Devices created will be
> matched to serdev drivers via modalias (the string provided by the user)
> and deleted via their name. Eg:

> +       nline = strchr(buf, '\n');

...

> +       if (nline)
> +               len = nline - buf;
> +       else

> +               len = strlen(buf);
> +       len = min(SERDEV_NAME_SIZE - 1, len);

If buf is guaranteed to have '\0', the strlen() is not needed.

I'm not sure about this entire dances with first line and so on.
When it's possible to get more, than two lines on input?

Would it be just as simple as strstrip() call followed by strscpy()?

> +       strncpy(serdev->modalias, buf, len);
> +       serdev->modalias[len] = '\0';

strspcy() ?

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux