From: Markus Elfring <Markus.Elfring@web.de>
To: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Christoph Lameter <cl@linux.com>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Pekka Enberg <penberg@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] mm/slab: One function call less in verify_redzone_free()
Date: Fri, 5 Jul 2019 16:50:26 +0200 [thread overview]
Message-ID: <90ca26d4-cc94-d7db-5ab4-ed04b29ced19@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 5 Jul 2019 16:40:09 +0200
Avoid an extra function call by using a ternary operator instead of
a conditional statement for a string literal selection.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
mm/slab.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 9df370558e5d..849b5c276588 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2701,10 +2701,10 @@ static inline void verify_redzone_free(struct kmem_cache *cache, void *obj)
if (redzone1 == RED_ACTIVE && redzone2 == RED_ACTIVE)
return;
- if (redzone1 == RED_INACTIVE && redzone2 == RED_INACTIVE)
- slab_error(cache, "double free detected");
- else
- slab_error(cache, "memory outside object was overwritten");
+ slab_error(cache,
+ redzone1 == RED_INACTIVE && redzone2 == RED_INACTIVE
+ ? "double free detected"
+ : "memory outside object was overwritten");
pr_err("%px: redzone 1:0x%llx, redzone 2:0x%llx\n",
obj, redzone1, redzone2);
--
2.22.0
next reply other threads:[~2019-07-05 14:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-05 14:50 Markus Elfring [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-07-05 14:50 [PATCH] mm/slab: One function call less in verify_redzone_free() Markus Elfring
2019-07-05 18:13 ` Christopher Lameter
2019-07-06 22:45 ` David Rientjes
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90ca26d4-cc94-d7db-5ab4-ed04b29ced19@web.de \
--to=markus.elfring@web.de \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).