Thread (49 messages) 49 messages, 5 authors, 2023-10-09

Re: [PATCH v2 1/3] rust: core abstractions for network PHY drivers

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2023-10-07 11:30:57
Also in: rust-for-linux

On Sat, Oct 07, 2023 at 08:23:24PM +0900, FUJITA Tomonori wrote:
On Sat, 7 Oct 2023 13:17:13 +0200
Greg KH [off-list ref] wrote:
quoted
On Sat, Oct 07, 2023 at 07:58:57PM +0900, FUJITA Tomonori wrote:
quoted
quoted
Since we're taking user input, it probably doesn't hurt to do some
sort of sanity check rather than casting. Maybe warn once then return
the biggest nowrapping value

    let speed_i32 = i32::try_from(speed).unwrap_or_else(|_| {
        warn_once!("excessive speed {speed}");
NEVER call WARN() on user input, as you now just rebooted the machine
and caused a DoS (and syzbot will start to spam you with reports.)
Trevor uses `user` as the user of this function, which is a PHY driver.
Ok, same thing in a way, just do a dev_warn() and return an error, no
need to do a full traceback splat at all.

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help