Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936374AbdGTX23 (ORCPT ); Thu, 20 Jul 2017 19:28:29 -0400 Received: from resqmta-po-01v.sys.comcast.net ([96.114.154.160]:56148 "EHLO resqmta-po-01v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934727AbdGTX21 (ORCPT ); Thu, 20 Jul 2017 19:28:27 -0400 Reply-To: shuah@kernel.org Subject: Re: [PATCH][V2] dvb_frontend: ensure that inital front end status initialized To: Colin King , Mauro Carvalho Chehab , Max Kellermann , Sakari Ailus , Markus Elfring , Ingo Molnar , Masahiro Yamada , linux-media@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Shuah Khan References: <20170720221207.7505-1-colin.king@canonical.com> From: Shuah Khan Message-ID: <95b98539-0db4-c877-35af-fd82dd78a8c1@kernel.org> Date: Thu, 20 Jul 2017 17:28:25 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170720221207.7505-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfJNhfXNXs77xQCgVpwkUnz9L12XyAUGB02TcGtO1dcc1OjNR/4dIf2jUx2xc/3yJuii915/epX6aT2DKZ8MfHDZvSimzYvooM8fMNdK8qTWsQIl/rDNm AYEHSYP4z1nf0Pc3iwWgDg8RW94bTdR1O2z375u1uoNpDhOOUy008WDI+13+J0DH/4IDrrHQ5hLx4kX887nPgsACywLxF4m6wd9gZ326StdQRUZeQD5OtiN+ Azwc8OQJoR6d/EdBg/c1bl20PGgo1xrPeIXaRgWwEv97iGY2/LojS3XskjstkmiN/WlCMFhBRElSSwShPIQ+E36DSlYNvLcvXXEWjn4uv1LUjIbSfU1gDdqV sbjkMbS0dexSLHMnVgin50RWLcu1RshHlmPh9Y7UTiU9KhTgvbbuS37+JMa29llutx2XeeeTfpYtk/aM/x5ekMw5rK/dXnWcHsUj/diUB0lUplf8YMQWAhUN va1zutgJS0A1lKitQt8ZFeYHI9le47RC1Raye80yg9mquQivk2XXLg2oG1LahZz8e3cn6YnmQesvWzSKPqPcKGJB1dI8FS4De/bCxS2PgTe3+yUZGNwwtgSA Jwk= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1956 Lines: 51 On 07/20/2017 04:12 PM, Colin King wrote: > From: Colin Ian King > > The fe_status variable s is not initialized meaning it can have any > random garbage status. This could be problematic if fe->ops.tune is > false as s is not updated by the call to fe->ops.tune() and a > subsequent check on the change status will using a garbage value. > Fix this by adding FE_NONE to the enum fe_status and initializing > s to this. > > Detected by CoverityScan, CID#112887 ("Uninitialized scalar variable") > > Signed-off-by: Colin Ian King Reviewed-by: Shuah Khan Looks good to me. Do you mind fixing dvb_frontend_swzigzag() as well. It currently initializes enum fe_status s = 0; in a separate patch. > --- > drivers/media/dvb-core/dvb_frontend.c | 2 +- > include/uapi/linux/dvb/frontend.h | 1 + > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c > index e3fff8f64d37..18cc3bbc699c 100644 > --- a/drivers/media/dvb-core/dvb_frontend.c > +++ b/drivers/media/dvb-core/dvb_frontend.c > @@ -631,7 +631,7 @@ static int dvb_frontend_thread(void *data) > struct dvb_frontend *fe = data; > struct dtv_frontend_properties *c = &fe->dtv_property_cache; > struct dvb_frontend_private *fepriv = fe->frontend_priv; > - enum fe_status s; > + enum fe_status s = FE_NONE; > enum dvbfe_algo algo; > bool re_tune = false; > bool semheld = false; > diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h > index 00a20cd21ee2..afc3972b0879 100644 > --- a/include/uapi/linux/dvb/frontend.h > +++ b/include/uapi/linux/dvb/frontend.h > @@ -127,6 +127,7 @@ enum fe_sec_mini_cmd { > * to reset DiSEqC, tone and parameters > */ > enum fe_status { > + FE_NONE = 0x00, > FE_HAS_SIGNAL = 0x01, > FE_HAS_CARRIER = 0x02, > FE_HAS_VITERBI = 0x04, >