LKML Archive on
 help / color / Atom feed
From: "tip-bot2 for Thomas Gleixner" <>
Cc: Thomas Gleixner <>,
	Ingo Molnar <>, Borislav Petkov <>,
Subject: [tip: x86/iopl] x86/ioperm: Avoid bitmap allocation if no permissions are set
Date: Sat, 16 Nov 2019 11:51:23 -0000
Message-ID: <157390508369.12247.423990236164065074.tip-bot2@tip-bot2> (raw)

The following commit has been merged into the x86/iopl branch of tip:

Commit-ID:     32f3bf67ee78332f2caec0984cb9d412cd0a3c23
Author:        Thomas Gleixner <>
AuthorDate:    Tue, 12 Nov 2019 19:56:19 +01:00
Committer:     Thomas Gleixner <>
CommitterDate: Sat, 16 Nov 2019 11:24:01 +01: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 <>
 arch/x86/kernel/ioport.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index ca6aa1e..80fa36b 100644
--- 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;

             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-16 11:51 tip-bot2 for Thomas Gleixner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-11-13 20:42 [patch V3 07/20] " Thomas Gleixner
2019-11-15 21:12 ` [tip: x86/iopl] " tip-bot2 for Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=157390508369.12247.423990236164065074.tip-bot2@tip-bot2 \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone