mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 23:27:06 +00:00
x86/ioperm: Avoid bitmap allocation if no permissions are set
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>
This commit is contained in:
parent
ae31cea86a
commit
32f3bf67ee
1 changed files with 3 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue