From patchwork Tue Sep 29 11:01:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 263197 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 624C2C4741F for ; Tue, 29 Sep 2020 11:54:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21A2A206A5 for ; Tue, 29 Sep 2020 11:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601380452; bh=fEJmQhPAKMkbY8sEpsumlVQIeQ+oUynX6P4xKhGDkMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HHRPbXcT+kSRxMMOHsBRMdM6DV4pE7AIkBXhm7O9hH5+gdWCasXX0K/PM+wHU6ex3 WJTf6MFXJ9mHRrca5bhK8AORm8NOY+KLwgfJqNjop12pOW6b8KVwAEnTxKdUoEOCe5 riPwqIgbSVkxC9BOa+hdMrR+9npJ9HaJXBxlXrTs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730938AbgI2Lxw (ORCPT ); Tue, 29 Sep 2020 07:53:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:47386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730882AbgI2Lq7 (ORCPT ); Tue, 29 Sep 2020 07:46:59 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 73331221E7; Tue, 29 Sep 2020 11:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601380015; bh=fEJmQhPAKMkbY8sEpsumlVQIeQ+oUynX6P4xKhGDkMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqIMIw0Qb6WVEeN7IozpDdKsYnlWFjHjrImwnxfCXQ2fpDD5q4w8P7574UlMf24zW TuzdFjbkKh2bGhX/0MG5T1rsZyYaSnUPKz9oSCnXKaiwxiEft4wbcDw6dlp+UghVTs 81nu0fzC8F1QnfNidppZb/YNkxiUouLN3kzQphLw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Michael Hennerich , Stefan Schmidt , Sasha Levin Subject: [PATCH 5.8 22/99] ieee802154/adf7242: check status of adf7242_read_reg Date: Tue, 29 Sep 2020 13:01:05 +0200 Message-Id: <20200929105930.818581847@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105929.719230296@linuxfoundation.org> References: <20200929105929.719230296@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tom Rix [ Upstream commit e3914ed6cf44bfe1f169e26241f8314556fd1ac1 ] Clang static analysis reports this error adf7242.c:887:6: warning: Assigned value is garbage or undefined len = len_u8; ^ ~~~~~~ len_u8 is set in adf7242_read_reg(lp, 0, &len_u8); When this call fails, len_u8 is not set. So check the return code. Fixes: 7302b9d90117 ("ieee802154/adf7242: Driver for ADF7242 MAC IEEE802154") Signed-off-by: Tom Rix Acked-by: Michael Hennerich Link: https://lore.kernel.org/r/20200802142339.21091-1-trix@redhat.com Signed-off-by: Stefan Schmidt Signed-off-by: Sasha Levin --- drivers/net/ieee802154/adf7242.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c index c11f32f644db3..7db9cbd0f5ded 100644 --- a/drivers/net/ieee802154/adf7242.c +++ b/drivers/net/ieee802154/adf7242.c @@ -882,7 +882,9 @@ static int adf7242_rx(struct adf7242_local *lp) int ret; u8 lqi, len_u8, *data; - adf7242_read_reg(lp, 0, &len_u8); + ret = adf7242_read_reg(lp, 0, &len_u8); + if (ret) + return ret; len = len_u8;