projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cda3756
)
n_hdlc: use clamp() for maxframe
author
Jiri Slaby
<jslaby@suse.cz>
Wed, 19 Feb 2020 08:41:00 +0000
(09:41 +0100)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Fri, 21 Feb 2020 09:24:32 +0000
(10:24 +0100)
It is easier to read. And use MAX_HDLC_FRAME_SIZE instead of magic
constant.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link:
https://lore.kernel.org/r/20200219084118.26491-6-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_hdlc.c
patch
|
blob
|
history
diff --git
a/drivers/tty/n_hdlc.c
b/drivers/tty/n_hdlc.c
index 87f22e57e4f638bd5facbb1dd74890a71b202847..a713a98fea2edc5e9568437c1dc9c91e78152f17 100644
(file)
--- a/
drivers/tty/n_hdlc.c
+++ b/
drivers/tty/n_hdlc.c
@@
-894,10
+894,7
@@
static int __init n_hdlc_init(void)
int status;
/* range check maxframe arg */
- if (maxframe < 4096)
- maxframe = 4096;
- else if (maxframe > 65535)
- maxframe = 65535;
+ maxframe = clamp(maxframe, 4096, MAX_HDLC_FRAME_SIZE);
status = tty_register_ldisc(N_HDLC, &n_hdlc_ldisc);
if (!status)