From patchwork Wed Apr 17 00:33:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13632792 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70ED8C4345F for ; Wed, 17 Apr 2024 00:33:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B4036B0089; Tue, 16 Apr 2024 20:33:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 063F36B008A; Tue, 16 Apr 2024 20:33:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E6D636B008C; Tue, 16 Apr 2024 20:33:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C93F46B0089 for ; Tue, 16 Apr 2024 20:33:55 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7DFD980CC6 for ; Wed, 17 Apr 2024 00:33:55 +0000 (UTC) X-FDA: 82017151230.28.1F4AB2D Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf04.hostedemail.com (Postfix) with ESMTP id CE3A640008 for ; Wed, 17 Apr 2024 00:33:53 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=22AbQxWm; spf=pass (imf04.hostedemail.com: domain of 38BgfZgYKCNUJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=38BgfZgYKCNUJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713314033; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=JBoignij4b6pxPqMg3EJqNELA9RvRPHOElI8T13Mar4=; b=4dsDBVIBytntI1VonZ9k/4zMZtrD/HGm1Rso4MP653/D2Zrg0EWATn0d7e10Tm2mg8m5S+ Js2kTwUEpQL5rQ9y4M03ew90a09gFhIIh75NYrnqBs9tCkd+xFtEmWLiKCwzzYbkV4ImhJ pFH+zKS8lD62A4k+2R8Tnu43NIFe9ic= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713314033; a=rsa-sha256; cv=none; b=7Jjlh+s/1DArl5d//oN6hUISTnMHfyI3NlqDQscSW2GcopV746/fzhaB34YtObPlVGNhHx jsf5rzyGeQNWjtzn/g8qhOHm4ROWbqczv4ghlA5IoSjW908xXiwJbmn9GKXcCFbDo+n1mH uHtqnieS4KmtOe2uIlLapNukR6adt2M= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=22AbQxWm; spf=pass (imf04.hostedemail.com: domain of 38BgfZgYKCNUJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=38BgfZgYKCNUJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-61ac7b815e5so47227927b3.0 for ; Tue, 16 Apr 2024 17:33:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713314033; x=1713918833; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=JBoignij4b6pxPqMg3EJqNELA9RvRPHOElI8T13Mar4=; b=22AbQxWm+A+akfzw/dSOI8aHEKL6R1iYSG4i7Q2UQz77VS6tBPIiWGbCdMHVGewnrp WngHZuBvlvPqmYDY3vRETkEDyC0X/RSNRTk9/kjRA9Maloecp/Ne4103NgTCLOsvFQnS 0YdTfIsz9euK7rPaP7Vrtc1yQz+k6i3KqfmV4KMe8C8HBl2Gm7t98u/kv4LdiEvB4XQa JkX0PnPY/nLR45NtVGsDL3YYX8kLU33UNl0zEzw4CCyCrpieMtdKLheeOAt0PpWVEM4Z 6v+e8ENh8mu0nClkm0zW+kCH9hD+Byre8KeDaQDnmsDOx2HabsO7DdALsQmNA+KyHvGF rruA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713314033; x=1713918833; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JBoignij4b6pxPqMg3EJqNELA9RvRPHOElI8T13Mar4=; b=uxzi7ubzRomn38xawGFZl3hX+zshP3kyU0ZnSb9YxkMZU7GqxY2pZ7ZD/iDAoHTRNt aHHxo8JyTcqSoLOVPN1pyObkDZPguJ6ZCBUNnqKU8E8ukY6H8muU/eQ07x129NsdBFhF dcjAkcgoFPJYVZrNEf9APQT07UiGSZZpbrOe3Ox3ONVDSS8MrqVXrojWiB00EemlPYWJ pfjL/RE/+9xSaLrzyAoowZiTcGYr8N/PYaBRQdAZQ0J0SntZNWpVzI+1GvOQKa8CIzfc MPdEbWLZUdji4DQPrThuHWsM1khSz66LnR9q4mizJNhng2R/EV+dJNSomqahMrQgUbgv gypQ== X-Forwarded-Encrypted: i=1; AJvYcCV461aN8gg2CL8v/9rozJIAwlc1i1DYlEycBk0M9Uf1Bekq4zhiJr9njbobg0eU+84upxDQGnSpL85sN2Unqx1JePI= X-Gm-Message-State: AOJu0YxmVsP+ZfBjVtTYCR7/uhQmtTdOU+qcX5P0hBIOWLRZPUOQpNCl zk5FKG6wHBs2LzW3jLlL3wH68aFtPRb3l5pvKLj/RQU+EQFPHzLYXHSSnAAvyaa8N3KvdFeoZnq 24A== X-Google-Smtp-Source: AGHT+IEepxxAu7uVkUy2oePDFVu/E0erqVdTli0BxZ9jZgQ7uqWWzQPDFwEbjQEjPC6oB2DuwPWxKEWxeLQ= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:93dc:2d0d:fde6:7002]) (user=surenb job=sendgmr) by 2002:a81:f10d:0:b0:61a:c438:69e7 with SMTP id h13-20020a81f10d000000b0061ac43869e7mr1961083ywm.2.1713314032827; Tue, 16 Apr 2024 17:33:52 -0700 (PDT) Date: Tue, 16 Apr 2024 17:33:49 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.683.g7961c838ac-goog Message-ID: <20240417003349.2520094-1-surenb@google.com> Subject: [PATCH 1/1] lib: fix alloc_tag_init() to prevent passing NULL to PTR_ERR() From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: kent.overstreet@linux.dev, dan.carpenter@linaro.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Suren Baghdasaryan , kernel test robot X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: CE3A640008 X-Rspam-User: X-Stat-Signature: rbo3j5tuknenrh7xqwxu9thi8fs1yuy4 X-HE-Tag: 1713314033-694825 X-HE-Meta: U2FsdGVkX1/Fbu74H4wxnAIrcO/L78S2IlZCSp9Ygmv2nT03AxXVoFBZNE+BSdJrRHgL5RT5Ilr/ElBLSZ3JwWITa4R+xsK+J+0DRaRgskCOQMqaNCai9HBiicu2aKiZa9vp5EjydDLD3dizhj6+bqqORbZGzVHpcqb0QuTcIBHloES6VrAjkQawgbo5XOwRwi1VdTpo/dKx1pXWoKatDb4ua+G4qf+tjrtaSTjvioh49Hzh7JkJ78DyDNvjkH8BoonXo5dZYJOISLIhk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C/gvTmgFyBCJGLGB65JVOp4Z4OwMGG31jde/OglEjQ3i4j5Ji2It1CUqqMCeGFjiS4Z91c9Yql/rw5TBPMgsQMxUSiweZXAhrlvg/GHhGol+6gdo5Md58EgqWeyRROlaXq3dMEIuKbCAFUjqJd8JGEg1gJuJC5ajYvBkCHduar3rYWOIoX53/jpkzNvCcfI+58WjxrOXgit9dNC1tWr48PEXOjCxzL2ONc6Na4XELiPsY0WqLf418HFFoE4bBzhtf2bPW5z9GuMK9LSEdog/1vtqEY03ueLE6mfOQtgIFbYkd4UcGsXjo3CM0OqrlpXnz1OwawOgxRCN6uX9j581S8257MXt7roxr+vxoepnEQKAFqBeDxn5TurKY0+tFEIQ0iYsM1G9ykcyWbcx/b7U5DmiHHEze57XPt8B1ToUWV9CN0+XhfrZ71KMtkv578H7xw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.001468, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: codetag_register_type() never returns NULL, yet IS_ERR_OR_NULL() is used to check its return value. This leads to a warning about possibility of passing NULL to PTR_ERR(). Fix that by using IS_ERR() to exclude NULL. Fixes: 6e8a230a6b1a ("lib: add allocation tagging support for memory allocation profiling") Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202404051340.7Wo7oiJ5-lkp@intel.com/ Signed-off-by: Suren Baghdasaryan --- lib/alloc_tag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 6723e3b1a668df6b8f305dea8fb62789155d965f diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c index b37e3430ed92..26af9982ddc4 100644 --- a/lib/alloc_tag.c +++ b/lib/alloc_tag.c @@ -233,7 +233,7 @@ static int __init alloc_tag_init(void) }; alloc_tag_cttype = codetag_register_type(&desc); - if (IS_ERR_OR_NULL(alloc_tag_cttype)) + if (IS_ERR(alloc_tag_cttype)) return PTR_ERR(alloc_tag_cttype); if (!mem_profiling_support)