Re: [PATCH 17/18] ledtrig-blkdev: Add mode (read/write/rw) sysfs attributue

Greg KH
2021-09-05T14:50:23Z

On Sat, Sep 04, 2021 at 04:01:56PM -0500, Ian Pilcher wrote:
> On 9/4/21 12:57 AM, Greg KH wrote:
> > Also, you are now allowing any user to spam the kernel log, this shold
> > be a dev_dbg() call at the most, if it is even needed at all. Same for
> > the other pr_info() call in this function, please remove them all.
>
> Greg -
>
> A bit of a "philosophical" question, if I may ...
>
> Is allowing the root user to "spam" the kernel log really a concern?

Yes.

> (The permissions on the attribute don't allow non-root users to write
> to it.)

Ah, but that was not obvious :)

> As a system administrator working with a sysfs API (or writing udev
> rules to do so), I know that I appreciate having a meaningful message in
> the log when something doesn't work.

That's fine, but do not allow a "normal" user to do so please.

> Given that only the root user can trigger these messages, would you be
> OK with dev_info()?

For a sysfs file failure, use dev_err(). If things are working
properly, your kernel code should be totally silent.

thanks,

greg k-h