Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6614789rdb; Fri, 15 Dec 2023 03:56:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9AGs8nzVkz21HoEZBIz3GMTLGuTPM3hnG4LN8XdJ7edkapdtlKBwYN2KaTLpoqYuqcb1X X-Received: by 2002:a92:ca4d:0:b0:35f:727b:217f with SMTP id q13-20020a92ca4d000000b0035f727b217fmr6264642ilo.41.1702641377077; Fri, 15 Dec 2023 03:56:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702641377; cv=none; d=google.com; s=arc-20160816; b=JkiHY0/WOQ6v1S+iPdNoFXItuBkrxjjUFO5FAh5FLrDYOsfJ2S7bC3H0PSa/uCPoO6 3pD8V388UumBaUlD3/n3amHydNW4AnPiEzyBhP4eLCmCaX/+B5s9tsEFKUOfhGik/Uep PnmV1lmTrOhpI5LKUMJ9wAZ3CYE3VhhNha7JhnU5IxZgfp8FiXMW7ZuLG4xRFfZ7p6tQ sNnatfjELQ9U7uqO4+HvropVKRQWDpBKAgB5tlqEse4aVGsGM2JYa0IC4IEafYM01xYw UUcp3OJrDPlR0iZOY/a1UawdeVS2cSRLr1jKOHyDPgTOz8/BdlOaFvGFByV/PBIMDIUs tGrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=EXThrm7r2Zne08IzRuM6iVKji7vFve1z4gpTqwOxd18=; fh=2Ocfh8oObV6XwDaQbZXmm0lCicccBNQW82OI4vXHf4w=; b=Ms6kK5lgXAv6b0e/qaR+BcYGNcnMzV1kGn5ShsSAZe7EyaHJ9jwi/H0CGZRFFrafZ9 WXoWl+PJ0TgEF8MJd+fM4PRAi9erICqLsAsJ8b5pYt4R44UTcFoOql+MLZW0pJdsnYKc QBOCF7L6I84ahl32BZCCoGxA3R9hGjHaueJt9yLFLw9/90kWRzX6XcyXlUWLHE4mpUNf BGeys9raFXkVqIkri0BrxEy32Pdav3Gy7dIZF5GZ8AxWPwEJKGYtyKSEBlRJXpV1S8Vv lBV1EH3KGLoAZtUIrscbocaJp5xVlo0viYtp5p+WM8yBjpt1+eMP8bfwLWawDSs6N486 Y6eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="t3tBdg/M"; spf=pass (google.com: domain of linux-crypto+bounces-871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j4-20020a654304000000b005c661efffd0si12593930pgq.754.2023.12.15.03.56.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 03:56:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="t3tBdg/M"; spf=pass (google.com: domain of linux-crypto+bounces-871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 50F83B21124 for ; Fri, 15 Dec 2023 11:55:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BC292DB6A; Fri, 15 Dec 2023 11:55:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="t3tBdg/M" X-Original-To: linux-crypto@vger.kernel.org Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2B6A2C86C; Fri, 15 Dec 2023 11:55:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3BF9ZBLs018517; Fri, 15 Dec 2023 12:19:09 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=selector1; bh=EXThrm7 r2Zne08IzRuM6iVKji7vFve1z4gpTqwOxd18=; b=t3tBdg/MiCqNpIB6GCXwL6f qqDNiklz9eMqXuU9dl5VPKlFmYelJDismj312Je3vlnb0KEzNrswuJUUl37MMLdo 2Mqm43NdHvPSS+dzfWekfrr5RBdNMOs0RKigVLFWAvk0OSNLp2hHPUcyfCxmD2ay unEEVAIM5Na4dXhl8J1XHJB1dAWt1vAVMKnHNNYjpXIUX1McwH1334eZszuouoeQ wBfg5r5wZgSKW1ZHUyT81l5RrsBXpj16zGMQGHSrvmeIdhcsqOGqdewC7xPAa64A zzFB1W50hQjGPoYiJRom3mmjKaW5cYC0TP9J4PtmpEZWMWqFpD4zOi9oIjVnRFg= = Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uyb2k9ec1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 12:19:08 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9BED4100052; Fri, 15 Dec 2023 12:19:04 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 618EE2138D7; Fri, 15 Dec 2023 12:19:04 +0100 (CET) Received: from localhost (10.201.20.61) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 15 Dec 2023 12:19:04 +0100 From: Thomas Bourgoin To: Herbert Xu , "David S . Miller" , Maxime Coquelin , Alexandre Torgue , Dan Carpenter CC: , , , , Thomas Bourgoin , kernel test robot Subject: [PATCH] crypto: stm32/crc32 - fix parsing list of devices Date: Fri, 15 Dec 2023 12:17:24 +0100 Message-ID: <20231215111724.864051-1-thomas.bourgoin@foss.st.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-15_06,2023-12-14_01,2023-05-22_02 smatch warnings: drivers/crypto/stm32/stm32-crc32.c:108 stm32_crc_get_next_crc() warn: can 'crc' even be NULL? Use list_first_entry_or_null instead of list_first_entry to retrieve the first device registered. The function list_first_entry always return a non NULL pointer even if the list is empty. Hence checking if the pointer returned is NULL does not tell if the list is empty or not. Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202311281111.ou2oUL2i-lkp@intel.com/ Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202311281111.ou2oUL2i-lkp@intel.com/ Signed-off-by: Thomas Bourgoin --- drivers/crypto/stm32/stm32-crc32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/stm32/stm32-crc32.c b/drivers/crypto/stm32/stm32-crc32.c index b2d5c8921ab3..b0cf6d2fd352 100644 --- a/drivers/crypto/stm32/stm32-crc32.c +++ b/drivers/crypto/stm32/stm32-crc32.c @@ -104,7 +104,7 @@ static struct stm32_crc *stm32_crc_get_next_crc(void) struct stm32_crc *crc; spin_lock_bh(&crc_list.lock); - crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); + crc = list_first_entry_or_null(&crc_list.dev_list, struct stm32_crc, list); if (crc) list_move_tail(&crc->list, &crc_list.dev_list); spin_unlock_bh(&crc_list.lock); -- 2.25.1