All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM / devfreq: exynos-ppmu: ppmu_events array should not be NULL terminated
@ 2016-09-21  0:30 ` Axel Lin
  2016-09-22  6:26   ` Chanwoo Choi
  0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2016-09-21  0:30 UTC (permalink / raw)
  To: Rafael J . Wysocki
  Cc: Chanwoo Choi, MyungJoo Ham, Kyungmin Park, linux-pm,
	linux-samsung-soc, Axel Lin

The rest of the code uses ARRAY_SIZE to count the number of entries in
ppmu_events array. The NULL terminated entry makes ARRAY_SIZE return
off-by-one value.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/devfreq/event/exynos-ppmu.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
index f55cf0e..c9ffaf0 100644
--- a/drivers/devfreq/event/exynos-ppmu.c
+++ b/drivers/devfreq/event/exynos-ppmu.c
@@ -90,8 +90,6 @@ struct __exynos_ppmu_events {
 	PPMU_EVENT(d1-cpu),
 	PPMU_EVENT(d1-general),
 	PPMU_EVENT(d1-rt),
-
-	{ /* sentinel */ },
 };
 
 static int exynos_ppmu_find_ppmu_id(struct devfreq_event_dev *edev)
-- 
2.7.4

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

* Re: [PATCH] PM / devfreq: exynos-ppmu: ppmu_events array should not be NULL terminated
  2016-09-21  0:30 ` [PATCH] PM / devfreq: exynos-ppmu: ppmu_events array should not be NULL terminated Axel Lin
@ 2016-09-22  6:26   ` Chanwoo Choi
  2016-09-30 14:06     ` MyungJoo Ham
  0 siblings, 1 reply; 3+ messages in thread
From: Chanwoo Choi @ 2016-09-22  6:26 UTC (permalink / raw)
  To: Axel Lin, Rafael J . Wysocki
  Cc: MyungJoo Ham, Kyungmin Park, linux-pm, linux-samsung-soc

Hello,

On 2016년 09월 21일 09:30, Axel Lin wrote:
> The rest of the code uses ARRAY_SIZE to count the number of entries in
> ppmu_events array. The NULL terminated entry makes ARRAY_SIZE return
> off-by-one value.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/devfreq/event/exynos-ppmu.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
> index f55cf0e..c9ffaf0 100644
> --- a/drivers/devfreq/event/exynos-ppmu.c
> +++ b/drivers/devfreq/event/exynos-ppmu.c
> @@ -90,8 +90,6 @@ struct __exynos_ppmu_events {
>  	PPMU_EVENT(d1-cpu),
>  	PPMU_EVENT(d1-general),
>  	PPMU_EVENT(d1-rt),
> -
> -	{ /* sentinel */ },
>  };
>  
>  static int exynos_ppmu_find_ppmu_id(struct devfreq_event_dev *edev)
> 

Acked-by: Chanwoo Choi <cw00.choi@samsung.com>

-- 
Best Regards,
Chanwoo Choi

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

* Re: [PATCH] PM / devfreq: exynos-ppmu: ppmu_events array should not be NULL terminated
  2016-09-22  6:26   ` Chanwoo Choi
@ 2016-09-30 14:06     ` MyungJoo Ham
  0 siblings, 0 replies; 3+ messages in thread
From: MyungJoo Ham @ 2016-09-30 14:06 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: Axel Lin, Rafael J . Wysocki, Kyungmin Park, Linux PM list,
	Linux Samsung SoC

On Thu, Sep 22, 2016 at 3:26 PM, Chanwoo Choi <cw00.choi@samsung.com> wrote:
> Hello,
>
> On 2016년 09월 21일 09:30, Axel Lin wrote:
>> The rest of the code uses ARRAY_SIZE to count the number of entries in
>> ppmu_events array. The NULL terminated entry makes ARRAY_SIZE return
>> off-by-one value.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>> ---
>>  drivers/devfreq/event/exynos-ppmu.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
>> index f55cf0e..c9ffaf0 100644
>> --- a/drivers/devfreq/event/exynos-ppmu.c
>> +++ b/drivers/devfreq/event/exynos-ppmu.c
>> @@ -90,8 +90,6 @@ struct __exynos_ppmu_events {
>>       PPMU_EVENT(d1-cpu),
>>       PPMU_EVENT(d1-general),
>>       PPMU_EVENT(d1-rt),
>> -
>> -     { /* sentinel */ },
>>  };
>>
>>  static int exynos_ppmu_find_ppmu_id(struct devfreq_event_dev *edev)
>>
>
> Acked-by: Chanwoo Choi <cw00.choi@samsung.com>

Chanwoo, do you feel comfortable with removing this sentinel? (you are
never going to rely on the sentinel in the future or in external codes
as well?)
Actually, although ppmu-event is using ARRAY_SIZE, because the loops
are looking for valid name, the correctness is not damaged.

Assuming yes, Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>

>
> --
> Best Regards,
> Chanwoo Choi
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
MyungJoo Ham, Ph.D.
Frontier CS Lab, S/W Center, Samsung Electronics

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

end of thread, other threads:[~2016-09-30 14:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20160921003108epcas1p13c13f6dbfbcf86c22d88e33606e8fc97@epcas1p1.samsung.com>
2016-09-21  0:30 ` [PATCH] PM / devfreq: exynos-ppmu: ppmu_events array should not be NULL terminated Axel Lin
2016-09-22  6:26   ` Chanwoo Choi
2016-09-30 14:06     ` MyungJoo Ham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.