linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: msm: Check cmd_db_read_aux_data() for failure
@ 2018-11-29 16:38 Stephen Boyd
  2018-11-29 22:36 ` Andy Gross
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2018-11-29 16:38 UTC (permalink / raw)
  To: Andy Gross
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Stephen Rothwell,
	kbuild test robot, Jordan Crouse, Bjorn Andersson, Evan Green,
	Rob Clark

We need to check the call to cmd_db_read_aux_data() for the error case,
so that we don't continue and use potentially uninitialized values for
'pri_count' and 'sec_count'. Otherwise, we get the following compiler
warnings:

   drivers/gpu/drm/msm/adreno/a6xx_gmu.c: In function 'a6xx_gmu_rpmh_arc_votes_init.isra.12':
   drivers/gpu/drm/msm/adreno/a6xx_gmu.c:943:12: warning: 'pri_count' is used uninitialized in this function [-Wuninitialized]
     pri_count >>= 1;
               ^~~
   drivers/gpu/drm/msm/adreno/a6xx_gmu.c:948:12: warning: 'sec_count' may be used uninitialized in this function
[-Wmaybe-uninitialized]
     sec_count >>= 1;
               ^~~

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: kbuild test robot <lkp@intel.com>
Cc: Jordan Crouse <jcrouse@codeaurora.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Evan Green <evgreen@chromium.org>
Cc: Jordan Crouse <jcrouse@codeaurora.org>
Cc: Rob Clark <robdclark@gmail.com>
Fixes: ed3cafa79ea7 ("soc: qcom: cmd-db: Stop memcpy()ing in cmd_db_read_aux_data()")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 8cd294e2846d..b450f7ea0422 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -936,6 +936,8 @@ static int a6xx_gmu_rpmh_arc_votes_init(struct device *dev, u32 *votes,
 	size_t pri_count, sec_count;
 
 	pri = cmd_db_read_aux_data(id, &pri_count);
+	if (IS_ERR(pri))
+		return PTR_ERR(pri);
 	/*
 	 * The data comes back as an array of unsigned shorts so adjust the
 	 * count accordingly
@@ -945,6 +947,9 @@ static int a6xx_gmu_rpmh_arc_votes_init(struct device *dev, u32 *votes,
 		return -EINVAL;
 
 	sec = cmd_db_read_aux_data("mx.lvl", &sec_count);
+	if (IS_ERR(sec))
+		return PTR_ERR(sec);
+
 	sec_count >>= 1;
 	if (!sec_count)
 		return -EINVAL;
-- 
Sent by a computer through tubes


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: msm: Check cmd_db_read_aux_data() for failure
  2018-11-29 16:38 [PATCH] drm: msm: Check cmd_db_read_aux_data() for failure Stephen Boyd
@ 2018-11-29 22:36 ` Andy Gross
  2018-11-29 22:42   ` Andy Gross
  2018-11-29 23:24   ` Rob Clark
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Gross @ 2018-11-29 22:36 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Stephen Rothwell,
	kbuild test robot, Jordan Crouse, Bjorn Andersson, Evan Green,
	Rob Clark

On Thu, Nov 29, 2018 at 08:38:26AM -0800, Stephen Boyd wrote:
> We need to check the call to cmd_db_read_aux_data() for the error case,
> so that we don't continue and use potentially uninitialized values for
> 'pri_count' and 'sec_count'. Otherwise, we get the following compiler
> warnings:
> 
>    drivers/gpu/drm/msm/adreno/a6xx_gmu.c: In function 'a6xx_gmu_rpmh_arc_votes_init.isra.12':
>    drivers/gpu/drm/msm/adreno/a6xx_gmu.c:943:12: warning: 'pri_count' is used uninitialized in this function [-Wuninitialized]
>      pri_count >>= 1;
>                ^~~
>    drivers/gpu/drm/msm/adreno/a6xx_gmu.c:948:12: warning: 'sec_count' may be used uninitialized in this function
> [-Wmaybe-uninitialized]
>      sec_count >>= 1;
>                ^~~
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Reported-by: kbuild test robot <lkp@intel.com>
> Cc: Jordan Crouse <jcrouse@codeaurora.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Evan Green <evgreen@chromium.org>
> Cc: Jordan Crouse <jcrouse@codeaurora.org>
> Cc: Rob Clark <robdclark@gmail.com>
> Fixes: ed3cafa79ea7 ("soc: qcom: cmd-db: Stop memcpy()ing in cmd_db_read_aux_data()")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Thanks for the patch.  Queueing this up.


Andy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: msm: Check cmd_db_read_aux_data() for failure
  2018-11-29 22:36 ` Andy Gross
@ 2018-11-29 22:42   ` Andy Gross
  2018-11-30  2:12     ` Stephen Rothwell
  2018-11-29 23:24   ` Rob Clark
  1 sibling, 1 reply; 6+ messages in thread
From: Andy Gross @ 2018-11-29 22:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Stephen Rothwell,
	kbuild test robot, Jordan Crouse, Bjorn Andersson, Evan Green,
	Rob Clark

On Thu, Nov 29, 2018 at 04:36:00PM -0600, Andy Gross wrote:
> On Thu, Nov 29, 2018 at 08:38:26AM -0800, Stephen Boyd wrote:
> > We need to check the call to cmd_db_read_aux_data() for the error case,
> > so that we don't continue and use potentially uninitialized values for
> > 'pri_count' and 'sec_count'. Otherwise, we get the following compiler
> > warnings:
> > 
> >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c: In function 'a6xx_gmu_rpmh_arc_votes_init.isra.12':
> >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c:943:12: warning: 'pri_count' is used uninitialized in this function [-Wuninitialized]
> >      pri_count >>= 1;
> >                ^~~
> >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c:948:12: warning: 'sec_count' may be used uninitialized in this function
> > [-Wmaybe-uninitialized]
> >      sec_count >>= 1;
> >                ^~~
> > 
> > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Reported-by: kbuild test robot <lkp@intel.com>
> > Cc: Jordan Crouse <jcrouse@codeaurora.org>
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > Cc: Evan Green <evgreen@chromium.org>
> > Cc: Jordan Crouse <jcrouse@codeaurora.org>
> > Cc: Rob Clark <robdclark@gmail.com>
> > Fixes: ed3cafa79ea7 ("soc: qcom: cmd-db: Stop memcpy()ing in cmd_db_read_aux_data()")
> > Signed-off-by: Stephen Boyd <swboyd@chromium.org>

On second thought, this needs to go through drm tree.

Reviewed-by: Andy Gross <andy.gross@linaro.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: msm: Check cmd_db_read_aux_data() for failure
  2018-11-29 22:36 ` Andy Gross
  2018-11-29 22:42   ` Andy Gross
@ 2018-11-29 23:24   ` Rob Clark
  1 sibling, 0 replies; 6+ messages in thread
From: Rob Clark @ 2018-11-29 23:24 UTC (permalink / raw)
  To: Andy Gross
  Cc: Stephen Boyd, Linux Kernel Mailing List, linux-arm-msm,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Stephen Rothwell, lkp, Jordan Crouse, Bjorn Andersson,
	Evan Green, Sean Paul

On Thu, Nov 29, 2018 at 5:36 PM Andy Gross <andy.gross@linaro.org> wrote:
>
> On Thu, Nov 29, 2018 at 08:38:26AM -0800, Stephen Boyd wrote:
> > We need to check the call to cmd_db_read_aux_data() for the error case,
> > so that we don't continue and use potentially uninitialized values for
> > 'pri_count' and 'sec_count'. Otherwise, we get the following compiler
> > warnings:
> >
> >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c: In function 'a6xx_gmu_rpmh_arc_votes_init.isra.12':
> >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c:943:12: warning: 'pri_count' is used uninitialized in this function [-Wuninitialized]
> >      pri_count >>= 1;
> >                ^~~
> >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c:948:12: warning: 'sec_count' may be used uninitialized in this function
> > [-Wmaybe-uninitialized]
> >      sec_count >>= 1;
> >                ^~~
> >
> > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Reported-by: kbuild test robot <lkp@intel.com>
> > Cc: Jordan Crouse <jcrouse@codeaurora.org>
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > Cc: Evan Green <evgreen@chromium.org>
> > Cc: Jordan Crouse <jcrouse@codeaurora.org>
> > Cc: Rob Clark <robdclark@gmail.com>
> > Fixes: ed3cafa79ea7 ("soc: qcom: cmd-db: Stop memcpy()ing in cmd_db_read_aux_data()")
> > Signed-off-by: Stephen Boyd <swboyd@chromium.org>
>
> Thanks for the patch.  Queueing this up.
>

from talking to agross on IRC, seems like this becomes an issue w/
other patches he has queued up for 4.21, and I don't think this should
conflict w/ other stuff I have, so

Acked-by: Rob Clark <robdclark@gmail.com>

for Andy picking up this one

BR,
-R

>
> Andy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: msm: Check cmd_db_read_aux_data() for failure
  2018-11-29 22:42   ` Andy Gross
@ 2018-11-30  2:12     ` Stephen Rothwell
  2018-11-30  2:34       ` Andy Gross
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2018-11-30  2:12 UTC (permalink / raw)
  To: Andy Gross
  Cc: Stephen Boyd, linux-kernel, linux-arm-msm, linux-arm-kernel,
	kbuild test robot, Jordan Crouse, Bjorn Andersson, Evan Green,
	Rob Clark

[-- Attachment #1: Type: text/plain, Size: 1674 bytes --]

Hi Andy,

On Thu, 29 Nov 2018 16:42:34 -0600 Andy Gross <andy.gross@linaro.org> wrote:
>
> On Thu, Nov 29, 2018 at 04:36:00PM -0600, Andy Gross wrote:
> > On Thu, Nov 29, 2018 at 08:38:26AM -0800, Stephen Boyd wrote:  
> > > We need to check the call to cmd_db_read_aux_data() for the error case,
> > > so that we don't continue and use potentially uninitialized values for
> > > 'pri_count' and 'sec_count'. Otherwise, we get the following compiler
> > > warnings:
> > > 
> > >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c: In function 'a6xx_gmu_rpmh_arc_votes_init.isra.12':
> > >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c:943:12: warning: 'pri_count' is used uninitialized in this function [-Wuninitialized]
> > >      pri_count >>= 1;
> > >                ^~~
> > >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c:948:12: warning: 'sec_count' may be used uninitialized in this function
> > > [-Wmaybe-uninitialized]
> > >      sec_count >>= 1;
> > >                ^~~
> > > 
> > > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > > Reported-by: kbuild test robot <lkp@intel.com>
> > > Cc: Jordan Crouse <jcrouse@codeaurora.org>
> > > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > > Cc: Evan Green <evgreen@chromium.org>
> > > Cc: Jordan Crouse <jcrouse@codeaurora.org>
> > > Cc: Rob Clark <robdclark@gmail.com>
> > > Fixes: ed3cafa79ea7 ("soc: qcom: cmd-db: Stop memcpy()ing in cmd_db_read_aux_data()")
> > > Signed-off-by: Stephen Boyd <swboyd@chromium.org>  
> 
> On second thought, this needs to go through drm tree.

Why?  The commit that introduces the warnings is only in the qcom
tree ...


-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: msm: Check cmd_db_read_aux_data() for failure
  2018-11-30  2:12     ` Stephen Rothwell
@ 2018-11-30  2:34       ` Andy Gross
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Gross @ 2018-11-30  2:34 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Stephen Boyd, linux-kernel, linux-arm-msm, linux-arm-kernel,
	kbuild test robot, Jordan Crouse, Bjorn Andersson, Evan Green,
	Rob Clark

On Fri, Nov 30, 2018 at 01:12:01PM +1100, Stephen Rothwell wrote:
> Hi Andy,
> 
> On Thu, 29 Nov 2018 16:42:34 -0600 Andy Gross <andy.gross@linaro.org> wrote:
> >
> > On Thu, Nov 29, 2018 at 04:36:00PM -0600, Andy Gross wrote:
> > > On Thu, Nov 29, 2018 at 08:38:26AM -0800, Stephen Boyd wrote:  
> > > > We need to check the call to cmd_db_read_aux_data() for the error case,
> > > > so that we don't continue and use potentially uninitialized values for
> > > > 'pri_count' and 'sec_count'. Otherwise, we get the following compiler
> > > > warnings:
> > > > 
> > > >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c: In function 'a6xx_gmu_rpmh_arc_votes_init.isra.12':
> > > >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c:943:12: warning: 'pri_count' is used uninitialized in this function [-Wuninitialized]
> > > >      pri_count >>= 1;
> > > >                ^~~
> > > >    drivers/gpu/drm/msm/adreno/a6xx_gmu.c:948:12: warning: 'sec_count' may be used uninitialized in this function
> > > > [-Wmaybe-uninitialized]
> > > >      sec_count >>= 1;
> > > >                ^~~
> > > > 
> > > > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > > > Reported-by: kbuild test robot <lkp@intel.com>
> > > > Cc: Jordan Crouse <jcrouse@codeaurora.org>
> > > > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > > > Cc: Evan Green <evgreen@chromium.org>
> > > > Cc: Jordan Crouse <jcrouse@codeaurora.org>
> > > > Cc: Rob Clark <robdclark@gmail.com>
> > > > Fixes: ed3cafa79ea7 ("soc: qcom: cmd-db: Stop memcpy()ing in cmd_db_read_aux_data()")
> > > > Signed-off-by: Stephen Boyd <swboyd@chromium.org>  
> > 
> > On second thought, this needs to go through drm tree.
> 
> Why?  The commit that introduces the warnings is only in the qcom

Sorry, I wasn't thinking it through earlier.  Yes, due to the two patches in our
tree changing the API, this needs to go through my tree.  I asked Rob to ack
it so I could take it in.  He did that and now it's been added to my pull and
also pushed to -next.

Sorry for the confusion on my part.

Andy

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-30  2:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 16:38 [PATCH] drm: msm: Check cmd_db_read_aux_data() for failure Stephen Boyd
2018-11-29 22:36 ` Andy Gross
2018-11-29 22:42   ` Andy Gross
2018-11-30  2:12     ` Stephen Rothwell
2018-11-30  2:34       ` Andy Gross
2018-11-29 23:24   ` Rob Clark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).