From patchwork Fri Jul 5 14:50:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 11032825 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 915CD13BD for ; Fri, 5 Jul 2019 14:50:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82D8A2871F for ; Fri, 5 Jul 2019 14:50:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7700728783; Fri, 5 Jul 2019 14:50:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D4A928683 for ; Fri, 5 Jul 2019 14:50:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 76F686B0006; Fri, 5 Jul 2019 10:50:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7208E8E0003; Fri, 5 Jul 2019 10:50:35 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E95E8E0001; Fri, 5 Jul 2019 10:50:35 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by kanga.kvack.org (Postfix) with ESMTP id 1144A6B0006 for ; Fri, 5 Jul 2019 10:50:35 -0400 (EDT) Received: by mail-wr1-f71.google.com with SMTP id x2so3834132wru.22 for ; Fri, 05 Jul 2019 07:50:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:to:cc:from:subject:openpgp :autocrypt:message-id:date:user-agent:mime-version:content-language :content-transfer-encoding; bh=TKLFIU6D13zx1N/Jp4vw89FUtPLQcozmodD6xhJ13kI=; b=l+mXTJznvQymAhIDgmReu0Xg6Js9I8uaL1ZlV0iJ2WQgaQNy+ZlyMGQy2KbzcVj6Vf sVpWrcmKRHKxgbXmzv1jtZpgRrN7+tq7uMVyP3KfJAWFl8InER90TULdh+0+o1PrE5FQ lvUPsC0DIU7WwcktVfmP67kJEBSL9cjy2QD+Rhr9N9M5Z8LrrJa2ABSOS44R9MQUeYW4 d5zirQNXXHNrEq2klVMAdOXFw5khKahN48szSVI37St6Q10HJ2atLHpHEcWdM7CKYpLF JpwUAAaQlJ7h618qBbU/uSdgUP8Y6A6f20xPg3aT2ErBJURSW0EOrAXiyRQy2TK0ZpiL QDfg== X-Gm-Message-State: APjAAAXL5lasL1zuduWGvchldZbixHoDXQbVfLQFVrGlyvxpdzr3qetD Hr4ZOEgGRUN8T4nttbQZTwyJFTqrCZ/4zfqjiFKSNhVKUi42K+AaGxP6vz6Wgl5PKXnBaSF/G+g fKY5+xzbEJKQghBMT7RwahJMIz2FSQfrayHDS4sRjOtsQrN9mRyCOd9+cprhklsLMRQ== X-Received: by 2002:a5d:540e:: with SMTP id g14mr4744341wrv.346.1562338234677; Fri, 05 Jul 2019 07:50:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFJnWAQr6DrBG9sSLO8DDlKn7rSzb0R56TKkxx7tWYU45P40ZH+q957EZ0egDsL4so/eq1 X-Received: by 2002:a5d:540e:: with SMTP id g14mr4744307wrv.346.1562338234036; Fri, 05 Jul 2019 07:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562338234; cv=none; d=google.com; s=arc-20160816; b=duwVBnS8EbQ9EG5bWqd4R3lN922473tb6BKfE7RvaXjXc4QFtcg4tAABUDb6Llo2xP ErG9A2OQXVFZOqIItfsUbFcmoM7m8zsGlEjNxAFXwu0sug27hokpMZ5HNID4r+228L0b QPAviBWTQyReDx8dCKNTN/rxmqRAsBPvCaBBDnB+AkHT4/DtgaaoPWx1R2lKJD2woRlf uJiKeRkRu5QH5BE25SntFgc+QxTVX+BnG5/VouMQRrWMHzOyYhMNcEk3vKYNJvK3IlaW Pt+bIYGmNlxBa5UOq7O9n6rU2DoLmdUvRHSlpUA+tDhLH/k6Hib8UR9bX28JeCijzqOU C8MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:mime-version:user-agent :date:message-id:autocrypt:openpgp:subject:from:cc:to:dkim-signature; bh=TKLFIU6D13zx1N/Jp4vw89FUtPLQcozmodD6xhJ13kI=; b=F4GS9mxQNtjUgiTOsCoeqGe4O/o4Zt7FeM2ttMFyE7bBxwNtjCEXIN4cKq9YLqSYLM fYinDZ5NKOedQTO6BBwJyoDwHf0hPt7rolVwWlsZAADycnJzpvdUFEsDNYBC2ZdL95Wp BPQex5/kabpmmrraYYQ6ec5bzkMQ9DOENr8qVd/FNZ0m2COJDQX0ZcLoBjrL0nd7B9fF 3IlZjjlv9Cp/T5TBGz7IhVfVfOO9H1jTZ6CLaEkWq5ZPHKExCo3NN1noB2NGvGnFI47x j2nB832HXv113+ozNcrPfgfMWwkGiN7kNLQpzgtq7Iz3BKArg1yl97YV49oPLSjqfCXs REbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@web.de header.s=dbaedf251592 header.b=lyH3f050; spf=pass (google.com: domain of markus.elfring@web.de designates 217.72.192.78 as permitted sender) smtp.mailfrom=Markus.Elfring@web.de Received: from mout.web.de (mout.web.de. [217.72.192.78]) by mx.google.com with ESMTPS id f3si2349790wmg.44.2019.07.05.07.50.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jul 2019 07:50:34 -0700 (PDT) Received-SPF: pass (google.com: domain of markus.elfring@web.de designates 217.72.192.78 as permitted sender) client-ip=217.72.192.78; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=dbaedf251592 header.b=lyH3f050; spf=pass (google.com: domain of markus.elfring@web.de designates 217.72.192.78 as permitted sender) smtp.mailfrom=Markus.Elfring@web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1562338228; bh=AHWuVzfHlb6NYXmK7t9+VzffJ18kF++Ty2DSAVesCBE=; h=X-UI-Sender-Class:To:Cc:From:Subject:Date; b=lyH3f050DGwnY9BQ7oK1CAPIgIaOqtfMuysq+aQ3PhKVVP2RdhjdeKZL+LWlAH6QM X1rjNnzw4Go07ywV85kg6r9XZA9hAaF/ZjCRDT+p5UugseZozk3XCfnsi6aPJ5D94h 2hlqjrF0yzMuEY5Fqv0YNtWIdy7B6Zc4L43Tub+c= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [192.168.1.2] ([2.244.45.164]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LbrZ2-1iQPn547ds-00jMl5; Fri, 05 Jul 2019 16:50:28 +0200 To: linux-mm@kvack.org, Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg Cc: LKML , kernel-janitors@vger.kernel.org From: Markus Elfring Subject: [PATCH] mm/slab: One function call less in verify_redzone_free() Openpgp: preference=signencrypt Autocrypt: addr=Markus.Elfring@web.de; prefer-encrypt=mutual; keydata= mQINBFg2+xABEADBJW2hoUoFXVFWTeKbqqif8VjszdMkriilx90WB5c0ddWQX14h6w5bT/A8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4b0gELjY1Oe9dBAXMiDwARAQABiQI8BBgBCAAmFiEEcM/SHOJt5ePBD8hO5T0WKDGD1rMF Alg2+xACGwwFCQlmAYAACgkQ5T0WKDGD1rOYSw/+P6fYSZjTJDAl9XNfXRjRRyJSfaw6N1pA Ahuu0MIa3djFRuFCrAHUaaFZf5V2iW5xhGnrhDwE1Ksf7tlstSne/G0a+Ef7vhUyeTn6U/0m +/BrsCsBUXhqeNuraGUtaleatQijXfuemUwgB+mE3B0SobE601XLo6MYIhPh8MG32MKO5kOY hB5jzyor7WoN3ETVNQoGgMzPVWIRElwpcXr+yGoTLAOpG7nkAUBBj9n9TPpSdt/npfok9ZfL /Q+ranrxb2Cy4tvOPxeVfR58XveX85ICrW9VHPVq9sJf/a24bMm6+qEg1V/G7u/AM3fM8U2m tdrTqOrfxklZ7beppGKzC1/WLrcr072vrdiN0icyOHQlfWmaPv0pUnW3AwtiMYngT96BevfA qlwaymjPTvH+cTXScnbydfOQW8220JQwykUe+sHRZfAF5TS2YCkQvsyf7vIpSqo/ttDk4+xc Z/wsLiWTgKlih2QYULvW61XU+mWsK8+ZlYUrRMpkauN4CJ5yTpvp+Orcz5KixHQmc5tbkLWf x0n1QFc1xxJhbzN+r9djSGGN/5IBDfUqSANC8cWzHpWaHmSuU3JSAMB/N+yQjIad2ztTckZY pwT6oxng29LzZspTYUEzMz3wK2jQHw+U66qBFk8whA7B2uAU1QdGyPgahLYSOa4XAEGb6wbI FEE= Message-ID: <90ca26d4-cc94-d7db-5ab4-ed04b29ced19@web.de> Date: Fri, 5 Jul 2019 16:50:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 Content-Language: en-US X-Provags-ID: V03:K1:QpkNiuBupiQ5eD6VrsoIqXZ3Q9nZAQJUYje5ATMR1Y+Qh2ZBv8b FTpeQQEfGPeiXrVBMTkyWy9St+I4N7Bg+Y4gK7cz90TmfvqOalHzA+0OOrYI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zOydnANZcsTQth/IQQ9HSH2Z2tjYsee5+bzbuVt3Qw23r45UtRloYGMppB E0Imw33VR3c29Il5Gobc25qSM97JTiu56jOmWh9zmL4I2D3kol+Ld8KKJ/4/aRl6Bz2HnAb+Y hxzWnvCZv4V+XOtFi6psM99A2nM+vcAYWXLaoFtEPoi16gM2rghXVNwu/JOiFWWoYhfPKIuUB VhRpJGtQRBDWkurI2OrZTiQqmJW4YEcuSsW X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring 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 --- mm/slab.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.22.0 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);