From patchwork Fri Dec 7 13:07:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10718119 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 C644413AF for ; Fri, 7 Dec 2018 13:08:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D890D2E353 for ; Fri, 7 Dec 2018 13:08:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC9F72E436; Fri, 7 Dec 2018 13:08:02 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DF082E35B for ; Fri, 7 Dec 2018 13:08:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726285AbeLGNIB (ORCPT ); Fri, 7 Dec 2018 08:08:01 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:33332 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbeLGNIA (ORCPT ); Fri, 7 Dec 2018 08:08:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=mYGu2l8QdCYHQuBk0O4Sq+QGUtkkmRuGS2DOrLSjq9U=; b=m1TEadZVOvFlj5p+fsr0vmN7sH 3Q+kQcFhPaD94czMGxPv3cUmD691zVpCbm2TdOAaLFM8ctGkCIwcFBl5WXDo285XMubv0tz93A7yE DZ4PAgrDGRyjtCblyzK3fc9oJ/dc6rDUXmGU8IkmjrBhHQmqElbc2IoJkDRd/hUct3oIQL9DPjyfL KI2Uxe1x5K9P+LA3Tmbys6wDrp54WYGa9TwaUfDuV9JPynCh0t9ow+shsbBvckn+WRAnjaQB+HIO6 /8dVCMk281IvKHTC+U8jtbdKNta9chCb8qk28DAuK+ZwvfAWMTrN1D2MS0ecYqR7nPKn86mlv0/KC 5/mN6WQA==; Received: from [179.95.33.236] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gVFrK-000336-Qp; Fri, 07 Dec 2018 13:07:58 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.91) (envelope-from ) id 1gVFrI-0004Pn-7r; Fri, 07 Dec 2018 08:07:56 -0500 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab , Peter Rosin , Wolfram Sang , Nick Desaulniers Subject: [PATCH 2/2] media: drxk_hard: check if parameter is not NULL Date: Fri, 7 Dec 2018 08:07:55 -0500 Message-Id: <94488f55b92ab1567dfeaf1fffb12fecc8c0b1d0.1544188058.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is a smatch warning: drivers/media/dvb-frontends/drxk_hard.c: drivers/media/dvb-frontends/drxk_hard.c:1478 scu_command() error: we previously assumed 'parameter' could be null (see line 1467) Telling that parameter might be NULL. Well, it can't, due to the way the driver works, but it doesn't hurt to add a check, in order to shut up smatch. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Nick Desaulniers --- drivers/media/dvb-frontends/drxk_hard.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-frontends/drxk_hard.c b/drivers/media/dvb-frontends/drxk_hard.c index 84ac3f73f8fe..8ea1e45be710 100644 --- a/drivers/media/dvb-frontends/drxk_hard.c +++ b/drivers/media/dvb-frontends/drxk_hard.c @@ -1474,9 +1474,11 @@ static int scu_command(struct drxk_state *state, /* assume that the command register is ready since it is checked afterwards */ - for (ii = parameter_len - 1; ii >= 0; ii -= 1) { - buffer[cnt++] = (parameter[ii] & 0xFF); - buffer[cnt++] = ((parameter[ii] >> 8) & 0xFF); + if (parameter) { + for (ii = parameter_len - 1; ii >= 0; ii -= 1) { + buffer[cnt++] = (parameter[ii] & 0xFF); + buffer[cnt++] = ((parameter[ii] >> 8) & 0xFF); + } } buffer[cnt++] = (cmd & 0xFF); buffer[cnt++] = ((cmd >> 8) & 0xFF);