projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ae31cea
)
x86/ioperm: Avoid bitmap allocation if no permissions are set
author
Thomas Gleixner
<tglx@linutronix.de>
Tue, 12 Nov 2019 18:56:19 +0000
(19:56 +0100)
committer
Thomas Gleixner
<tglx@linutronix.de>
Sat, 16 Nov 2019 10:24:01 +0000
(11:24 +0100)
If ioperm() is invoked the first time and the @turn_on argument is 0, then
there is no point to allocate a bitmap just to clear permissions which are
not set.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/ioport.c
patch
|
blob
|
history
diff --git
a/arch/x86/kernel/ioport.c
b/arch/x86/kernel/ioport.c
index
ca6aa1e
..
80fa36b
100644
(file)
--- a/
arch/x86/kernel/ioport.c
+++ b/
arch/x86/kernel/ioport.c
@@
-36,6
+36,9
@@
long ksys_ioperm(unsigned long from, unsigned long num, int turn_on)
*/
bitmap = t->io_bitmap_ptr;
if (!bitmap) {
+ /* No point to allocate a bitmap just to clear permissions */
+ if (!turn_on)
+ return 0;
bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
if (!bitmap)
return -ENOMEM;