* [PATCH] gpu: drm: swsmu: fix error return code of smu_v11_0_set_allowed_mask() @ 2021-03-05 3:54 Jia-Ju Bai 2021-03-05 4:02 ` Quan, Evan 0 siblings, 1 reply; 3+ messages in thread From: Jia-Ju Bai @ 2021-03-05 3:54 UTC (permalink / raw) To: alexander.deucher, christian.koenig, airlied, daniel, evan.quan, Hawking.Zhang, kevin1.wang, Likun.Gao Cc: amd-gfx, dri-devel, linux-kernel, Jia-Ju Bai When bitmap_empty() or feature->feature_num triggers an error, no error return code of smu_v11_0_set_allowed_mask() is assigned. To fix this bug, ret is assigned with -EINVAL as error return code. Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c index 90585461a56e..82731a932308 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c @@ -747,8 +747,10 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu) int ret = 0; uint32_t feature_mask[2]; - if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64) + if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64) { + ret = -EINVAL; goto failed; + } bitmap_copy((unsigned long *)feature_mask, feature->allowed, 64); -- 2.17.1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] gpu: drm: swsmu: fix error return code of smu_v11_0_set_allowed_mask() 2021-03-05 3:54 [PATCH] gpu: drm: swsmu: fix error return code of smu_v11_0_set_allowed_mask() Jia-Ju Bai @ 2021-03-05 4:02 ` Quan, Evan 2021-03-08 21:14 ` Alex Deucher 0 siblings, 1 reply; 3+ messages in thread From: Quan, Evan @ 2021-03-05 4:02 UTC (permalink / raw) To: Jia-Ju Bai, Deucher, Alexander, Koenig, Christian, airlied, daniel, Zhang, Hawking, Wang, Kevin(Yang), Gao, Likun Cc: amd-gfx, dri-devel, linux-kernel [AMD Public Use] Thanks. Reviewed-by: Evan Quan <evan.quan@amd.com> -----Original Message----- From: Jia-Ju Bai <baijiaju1990@gmail.com> Sent: Friday, March 5, 2021 11:54 AM To: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; airlied@linux.ie; daniel@ffwll.ch; Quan, Evan <Evan.Quan@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; Gao, Likun <Likun.Gao@amd.com> Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; Jia-Ju Bai <baijiaju1990@gmail.com> Subject: [PATCH] gpu: drm: swsmu: fix error return code of smu_v11_0_set_allowed_mask() When bitmap_empty() or feature->feature_num triggers an error, no error return code of smu_v11_0_set_allowed_mask() is assigned. To fix this bug, ret is assigned with -EINVAL as error return code. Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c index 90585461a56e..82731a932308 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c @@ -747,8 +747,10 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu) int ret = 0; uint32_t feature_mask[2]; - if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64) + if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64) { + ret = -EINVAL; goto failed; + } bitmap_copy((unsigned long *)feature_mask, feature->allowed, 64); -- 2.17.1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpu: drm: swsmu: fix error return code of smu_v11_0_set_allowed_mask() 2021-03-05 4:02 ` Quan, Evan @ 2021-03-08 21:14 ` Alex Deucher 0 siblings, 0 replies; 3+ messages in thread From: Alex Deucher @ 2021-03-08 21:14 UTC (permalink / raw) To: Quan, Evan Cc: Jia-Ju Bai, Deucher, Alexander, Koenig, Christian, airlied, daniel, Zhang, Hawking, Wang, Kevin(Yang), Gao, Likun, dri-devel, amd-gfx, linux-kernel Applied. Thanks! Alex On Thu, Mar 4, 2021 at 11:02 PM Quan, Evan <Evan.Quan@amd.com> wrote: > > [AMD Public Use] > > Thanks. Reviewed-by: Evan Quan <evan.quan@amd.com> > > -----Original Message----- > From: Jia-Ju Bai <baijiaju1990@gmail.com> > Sent: Friday, March 5, 2021 11:54 AM > To: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; airlied@linux.ie; daniel@ffwll.ch; Quan, Evan <Evan.Quan@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; Gao, Likun <Likun.Gao@amd.com> > Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; Jia-Ju Bai <baijiaju1990@gmail.com> > Subject: [PATCH] gpu: drm: swsmu: fix error return code of smu_v11_0_set_allowed_mask() > > When bitmap_empty() or feature->feature_num triggers an error, no error return code of smu_v11_0_set_allowed_mask() is assigned. > To fix this bug, ret is assigned with -EINVAL as error return code. > > Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> > Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> > --- > drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c > index 90585461a56e..82731a932308 100644 > --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c > @@ -747,8 +747,10 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu) > int ret = 0; > uint32_t feature_mask[2]; > > - if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64) > + if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64) { > + ret = -EINVAL; > goto failed; > + } > > bitmap_copy((unsigned long *)feature_mask, feature->allowed, 64); > > -- > 2.17.1 > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-08 21:16 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-03-05 3:54 [PATCH] gpu: drm: swsmu: fix error return code of smu_v11_0_set_allowed_mask() Jia-Ju Bai 2021-03-05 4:02 ` Quan, Evan 2021-03-08 21:14 ` Alex Deucher
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®