From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 58BB853816; Wed, 21 Feb 2024 13:14:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708521261; cv=none; b=bK7i5+oipyaERJAQ/v7F/ZBCNTo5jHu9z5h2CtTLJyb0MdmE9MM/pwHNuJgxLHGgXxlmr5KeQ0JJeb7WCZM+S1BEj0VJrhRMpVuZIsWYxFjWrXrtHHMfp19DEtwdObWZWbYXHI3HyrjNrc1cXjGzKXvZKV7EaZmcOcaldpH4p/M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708521261; c=relaxed/simple; bh=2z1cob3ILXosoxfYZLvxW2Lo2acx8QzPB7VW2iyW/vI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DePT9LJGONAF0yIaHV99F8rBLUiEtHBMCn+jGtFEhHjLif3kMdAX4Y/0Lj19G/Icw1z9Dx1sHNRJg5WoUHYJD9jivlVepO32l79kZkuR6S8fHIiicQuSc2QERfB7NeWKp7P1g8EcDWpD7k+ZyzylQSt/ay2I+rLYjQy0yQsj30A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ohyHGJeA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ohyHGJeA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9846C433C7; Wed, 21 Feb 2024 13:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1708521261; bh=2z1cob3ILXosoxfYZLvxW2Lo2acx8QzPB7VW2iyW/vI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ohyHGJeACIZy5tzQwYxZ1td0QgOq7HNr1rFzUjuYZMzPgmQb4Y4NL8LloJr6P8nmY vuUhglJY5LC2elOpyWADGSxKLhCLM5zayqq/5LjRjIdejMxxj1O6eindlRERt+NWht LxEDUhnU26366CEyHh/03Ym+nshh3Y3zkIsfOS34= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, kernel test robot , Dan Carpenter , Thomas Bourgoin , Herbert Xu , Sasha Levin Subject: [PATCH 4.19 064/202] crypto: stm32/crc32 - fix parsing list of devices Date: Wed, 21 Feb 2024 14:06:05 +0100 Message-ID: <20240221125933.905325722@linuxfoundation.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240221125931.742034354@linuxfoundation.org> References: <20240221125931.742034354@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Bourgoin [ Upstream commit 0eaef675b94c746900dcea7f6c41b9a103ed5d53 ] 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 Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- 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 de645bf84980..04adc84d677c 100644 --- a/drivers/crypto/stm32/stm32_crc32.c +++ b/drivers/crypto/stm32/stm32_crc32.c @@ -98,7 +98,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.43.0