* [PATCH] drm/amd/pm: replace 1-element arrays with flexible-array members
@ 2023-11-08 6:54 José Pekkarinen
2023-11-08 7:29 ` Greg KH
0 siblings, 1 reply; 7+ messages in thread
From: José Pekkarinen @ 2023-11-08 6:54 UTC (permalink / raw)
To: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan, skhan
Cc: José Pekkarinen, airlied, daniel, amd-gfx, dri-devel,
linux-kernel, linux-kernel-mentees
The following case seems to be safe to be replaced with a flexible array
to clean up the added coccinelle warning. This patch will just do it.
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h:76:38-63: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
---
drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
index c7b61222d258..1ce4087005f0 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
@@ -73,7 +73,7 @@ struct smu8_register_index_data_pair {
struct smu8_ih_meta_data {
uint32_t command;
- struct smu8_register_index_data_pair register_index_value_pair[1];
+ struct smu8_register_index_data_pair register_index_value_pair[];
};
struct smu8_smumgr {
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] drm/amd/pm: replace 1-element arrays with flexible-array members
2023-11-08 6:54 [PATCH] drm/amd/pm: replace 1-element arrays with flexible-array members José Pekkarinen
@ 2023-11-08 7:29 ` Greg KH
2023-11-09 8:43 ` José Pekkarinen
0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2023-11-08 7:29 UTC (permalink / raw)
To: José Pekkarinen
Cc: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan,
skhan, airlied, daniel, amd-gfx, dri-devel, linux-kernel,
linux-kernel-mentees
On Wed, Nov 08, 2023 at 08:54:35AM +0200, José Pekkarinen wrote:
> The following case seems to be safe to be replaced with a flexible array
> to clean up the added coccinelle warning. This patch will just do it.
>
> drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h:76:38-63: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
>
> Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
> ---
> drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
> index c7b61222d258..1ce4087005f0 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
> +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
> @@ -73,7 +73,7 @@ struct smu8_register_index_data_pair {
>
> struct smu8_ih_meta_data {
> uint32_t command;
> - struct smu8_register_index_data_pair register_index_value_pair[1];
> + struct smu8_register_index_data_pair register_index_value_pair[];
Did you just change this structure size without any need to change any
code as well? How was this tested?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] drm/amd/pm: replace 1-element arrays with flexible-array members
2023-11-08 7:29 ` Greg KH
@ 2023-11-09 8:43 ` José Pekkarinen
2023-11-09 9:06 ` Greg KH
0 siblings, 1 reply; 7+ messages in thread
From: José Pekkarinen @ 2023-11-09 8:43 UTC (permalink / raw)
To: Greg KH
Cc: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan,
skhan, airlied, daniel, amd-gfx, dri-devel, linux-kernel,
linux-kernel-mentees
On 2023-11-08 09:29, Greg KH wrote:
> On Wed, Nov 08, 2023 at 08:54:35AM +0200, José Pekkarinen wrote:
>> The following case seems to be safe to be replaced with a flexible
>> array
>> to clean up the added coccinelle warning. This patch will just do it.
>>
>> drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h:76:38-63:
>> WARNING use flexible-array member instead
>> (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
>>
>> Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
>> ---
>> drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
>> b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
>> index c7b61222d258..1ce4087005f0 100644
>> --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
>> +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
>> @@ -73,7 +73,7 @@ struct smu8_register_index_data_pair {
>>
>> struct smu8_ih_meta_data {
>> uint32_t command;
>> - struct smu8_register_index_data_pair register_index_value_pair[1];
>> + struct smu8_register_index_data_pair register_index_value_pair[];
>
> Did you just change this structure size without any need to change any
> code as well? How was this tested?
I didn't find any use of that struct member, if I missed
something here, please let me know and I'll happily address any
needed further work.
José.
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] drm/amd/pm: replace 1-element arrays with flexible-array members
2023-11-09 8:43 ` José Pekkarinen
@ 2023-11-09 9:06 ` Greg KH
2023-11-09 11:54 ` José Pekkarinen
0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2023-11-09 9:06 UTC (permalink / raw)
To: José Pekkarinen
Cc: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan,
skhan, airlied, daniel, amd-gfx, dri-devel, linux-kernel,
linux-kernel-mentees
On Thu, Nov 09, 2023 at 10:43:50AM +0200, José Pekkarinen wrote:
> On 2023-11-08 09:29, Greg KH wrote:
> > On Wed, Nov 08, 2023 at 08:54:35AM +0200, José Pekkarinen wrote:
> > > The following case seems to be safe to be replaced with a flexible
> > > array
> > > to clean up the added coccinelle warning. This patch will just do it.
> > >
> > > drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h:76:38-63:
> > > WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
> > >
> > > Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
> > > ---
> > > drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
> > > b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
> > > index c7b61222d258..1ce4087005f0 100644
> > > --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
> > > +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
> > > @@ -73,7 +73,7 @@ struct smu8_register_index_data_pair {
> > >
> > > struct smu8_ih_meta_data {
> > > uint32_t command;
> > > - struct smu8_register_index_data_pair register_index_value_pair[1];
> > > + struct smu8_register_index_data_pair register_index_value_pair[];
> >
> > Did you just change this structure size without any need to change any
> > code as well? How was this tested?
>
> I didn't find any use of that struct member, if I missed
> something here, please let me know and I'll happily address any
> needed further work.
I don't think this is even a variable array. It's just a one element
one, which is fine, don't be confused by the coccinelle "warning" here,
it's fired many false-positives and you need to verify this properly
with the driver authors first before changing anything.
In short, you just changed the size of this structure, are you _sure_
you can do that? And yes, it doesn't look like this field is used, but
the structure is, so be careful.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] drm/amd/pm: replace 1-element arrays with flexible-array members
2023-11-09 9:06 ` Greg KH
@ 2023-11-09 11:54 ` José Pekkarinen
2023-11-09 15:40 ` Alex Deucher
0 siblings, 1 reply; 7+ messages in thread
From: José Pekkarinen @ 2023-11-09 11:54 UTC (permalink / raw)
To: Greg KH
Cc: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan,
skhan, airlied, daniel, amd-gfx, dri-devel, linux-kernel,
linux-kernel-mentees
On 2023-11-09 11:06, Greg KH wrote:
> On Thu, Nov 09, 2023 at 10:43:50AM +0200, José Pekkarinen wrote:
>> On 2023-11-08 09:29, Greg KH wrote:
>> > On Wed, Nov 08, 2023 at 08:54:35AM +0200, José Pekkarinen wrote:
>> > > The following case seems to be safe to be replaced with a flexible
>> > > array
>> > > to clean up the added coccinelle warning. This patch will just do it.
>> > >
>> > > drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h:76:38-63:
>> > > WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
>> > >
>> > > Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
>> > > ---
>> > > drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h | 2 +-
>> > > 1 file changed, 1 insertion(+), 1 deletion(-)
>> > >
>> > > diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
>> > > b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
>> > > index c7b61222d258..1ce4087005f0 100644
>> > > --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
>> > > +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
>> > > @@ -73,7 +73,7 @@ struct smu8_register_index_data_pair {
>> > >
>> > > struct smu8_ih_meta_data {
>> > > uint32_t command;
>> > > - struct smu8_register_index_data_pair register_index_value_pair[1];
>> > > + struct smu8_register_index_data_pair register_index_value_pair[];
>> >
>> > Did you just change this structure size without any need to change any
>> > code as well? How was this tested?
>>
>> I didn't find any use of that struct member, if I missed
>> something here, please let me know and I'll happily address any
>> needed further work.
>
> I don't think this is even a variable array. It's just a one element
> one, which is fine, don't be confused by the coccinelle "warning" here,
> it's fired many false-positives and you need to verify this properly
> with the driver authors first before changing anything.
My apologies to you, and anybody that feels the same, it is not my
intention to bother with mistaken patches, I just assume that this patch
or any other from me, will go to review process, where it should be fine
if the patch is right, wrong, need further work, or further testing
either
from my side or anybody else, and at the end of the day I need to do
patches if I want to find my mentorship patches, and graduate.
> In short, you just changed the size of this structure, are you _sure_
> you can do that? And yes, it doesn't look like this field is used, but
> the structure is, so be careful.
I don't know, let check it out together and see where this goes.
José.
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] drm/amd/pm: replace 1-element arrays with flexible-array members
2023-11-09 11:54 ` José Pekkarinen
@ 2023-11-09 15:40 ` Alex Deucher
0 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2023-11-09 15:40 UTC (permalink / raw)
To: José Pekkarinen
Cc: Greg KH, Xinhui.Pan, linux-kernel, amd-gfx, dri-devel, skhan,
alexander.deucher, evan.quan, christian.koenig,
linux-kernel-mentees
On Thu, Nov 9, 2023 at 7:14 AM José Pekkarinen
<jose.pekkarinen@foxhound.fi> wrote:
>
> On 2023-11-09 11:06, Greg KH wrote:
> > On Thu, Nov 09, 2023 at 10:43:50AM +0200, José Pekkarinen wrote:
> >> On 2023-11-08 09:29, Greg KH wrote:
> >> > On Wed, Nov 08, 2023 at 08:54:35AM +0200, José Pekkarinen wrote:
> >> > > The following case seems to be safe to be replaced with a flexible
> >> > > array
> >> > > to clean up the added coccinelle warning. This patch will just do it.
> >> > >
> >> > > drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h:76:38-63:
> >> > > WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
> >> > >
> >> > > Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
> >> > > ---
> >> > > drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h | 2 +-
> >> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> >> > >
> >> > > diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
> >> > > b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
> >> > > index c7b61222d258..1ce4087005f0 100644
> >> > > --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
> >> > > +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu8_smumgr.h
> >> > > @@ -73,7 +73,7 @@ struct smu8_register_index_data_pair {
> >> > >
> >> > > struct smu8_ih_meta_data {
> >> > > uint32_t command;
> >> > > - struct smu8_register_index_data_pair register_index_value_pair[1];
> >> > > + struct smu8_register_index_data_pair register_index_value_pair[];
> >> >
> >> > Did you just change this structure size without any need to change any
> >> > code as well? How was this tested?
> >>
> >> I didn't find any use of that struct member, if I missed
> >> something here, please let me know and I'll happily address any
> >> needed further work.
> >
> > I don't think this is even a variable array. It's just a one element
> > one, which is fine, don't be confused by the coccinelle "warning" here,
> > it's fired many false-positives and you need to verify this properly
> > with the driver authors first before changing anything.
>
> My apologies to you, and anybody that feels the same, it is not my
> intention to bother with mistaken patches, I just assume that this patch
> or any other from me, will go to review process, where it should be fine
> if the patch is right, wrong, need further work, or further testing
> either
> from my side or anybody else, and at the end of the day I need to do
> patches if I want to find my mentorship patches, and graduate.
>
> > In short, you just changed the size of this structure, are you _sure_
> > you can do that? And yes, it doesn't look like this field is used, but
> > the structure is, so be careful.
>
> I don't know, let check it out together and see where this goes.
I think it may have been used with the SMU firmware. I'll need to
check with that team to determine if this was meant to be a variable
sized array or not.
Alex
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] drm/amd/pm: replace 1-element arrays with flexible-array members
@ 2023-11-08 6:55 José Pekkarinen
0 siblings, 0 replies; 7+ messages in thread
From: José Pekkarinen @ 2023-11-08 6:55 UTC (permalink / raw)
To: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan, skhan
Cc: José Pekkarinen, airlied, daniel, sunran001, lijo.lazar,
colin.i.king, amd-gfx, dri-devel, linux-kernel,
linux-kernel-mentees
While the structures affected seems to be unused along the driver the
following patch will care of replacing their members to flexible array,
removing the following warnings:
drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h:169:47-54: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h:174:47-54: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h:179:48-55: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h:184:47-54: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h:518:32-39: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
---
drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h
index 81650727a5de..082d0bb79277 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h
@@ -166,22 +166,22 @@ struct phm_phase_shedding_limits_table {
struct phm_vceclock_voltage_dependency_table {
uint8_t count; /* Number of entries. */
- struct phm_vceclock_voltage_dependency_record entries[1]; /* Dynamically allocate count entries. */
+ struct phm_vceclock_voltage_dependency_record entries[]; /* Dynamically allocate count entries. */
};
struct phm_uvdclock_voltage_dependency_table {
uint8_t count; /* Number of entries. */
- struct phm_uvdclock_voltage_dependency_record entries[1]; /* Dynamically allocate count entries. */
+ struct phm_uvdclock_voltage_dependency_record entries[]; /* Dynamically allocate count entries. */
};
struct phm_samuclock_voltage_dependency_table {
uint8_t count; /* Number of entries. */
- struct phm_samuclock_voltage_dependency_record entries[1]; /* Dynamically allocate count entries. */
+ struct phm_samuclock_voltage_dependency_record entries[]; /* Dynamically allocate count entries. */
};
struct phm_acpclock_voltage_dependency_table {
uint32_t count; /* Number of entries. */
- struct phm_acpclock_voltage_dependency_record entries[1]; /* Dynamically allocate count entries. */
+ struct phm_acpclock_voltage_dependency_record entries[]; /* Dynamically allocate count entries. */
};
struct phm_vce_clock_voltage_dependency_table {
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-11-09 15:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-08 6:54 [PATCH] drm/amd/pm: replace 1-element arrays with flexible-array members José Pekkarinen
2023-11-08 7:29 ` Greg KH
2023-11-09 8:43 ` José Pekkarinen
2023-11-09 9:06 ` Greg KH
2023-11-09 11:54 ` José Pekkarinen
2023-11-09 15:40 ` Alex Deucher
2023-11-08 6:55 José Pekkarinen
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®