Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1693033 > unrolled thread

[PATCH] [media] dvb_frontend: ensure that front end status is initialized

Started byColin King <colin.king@canonical.com>
First post2017-07-20 17:30 +0200
Last post2017-07-20 17:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] [media] dvb_frontend: ensure that front end status is initialized Colin King <colin.king@canonical.com> - 2017-07-20 17:30 +0200
    Re: [PATCH] [media] dvb_frontend: ensure that front end status is  initialized Shuah Khan <shuah@kernel.org> - 2017-07-20 17:50 +0200

#1693033 — [PATCH] [media] dvb_frontend: ensure that front end status is initialized

FromColin King <colin.king@canonical.com>
Date2017-07-20 17:30 +0200
Subject[PATCH] [media] dvb_frontend: ensure that front end status is initialized
Message-ID<u5lyO-QM-15@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

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 initializing s to zero.

Detected by CoverityScan, CID#112887 ("Uninitialized scalar variable")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/media/dvb-core/dvb_frontend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index e3fff8f64d37..e18ea1508a59 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 = 0;
 	enum dvbfe_algo algo;
 	bool re_tune = false;
 	bool semheld = false;
-- 
2.11.0

[toc] | [next] | [standalone]


#1693041 — Re: [PATCH] [media] dvb_frontend: ensure that front end status is initialized

FromShuah Khan <shuah@kernel.org>
Date2017-07-20 17:50 +0200
SubjectRe: [PATCH] [media] dvb_frontend: ensure that front end status is initialized
Message-ID<u5lSb-XA-23@gated-at.bofh.it>
In reply to#1693033
Hi Colin,

On 07/20/2017 09:29 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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 initializing s to zero.
> 
> Detected by CoverityScan, CID#112887 ("Uninitialized scalar variable")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/media/dvb-core/dvb_frontend.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
> index e3fff8f64d37..e18ea1508a59 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 = 0;

0 isn't a valid value for enum fe_status. I think the right fix would be
to add FE_NONE to enum fe_status and then initialize s to that.

thanks,
-- Shuah


>  	enum dvbfe_algo algo;
>  	bool re_tune = false;
>  	bool semheld = false;
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web