diff mbox series

hdata: Make sure FW feature name is not NULL

Message ID 20180911052014.2206-1-hegdevasant@linux.vnet.ibm.com
State Accepted
Headers show
Series hdata: Make sure FW feature name is not NULL | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/make_check success Test make_check on branch master

Commit Message

Vasant Hegde Sept. 11, 2018, 5:20 a.m. UTC
CC: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 hdata/spira.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Vaibhav Jain Sept. 12, 2018, 2:30 a.m. UTC | #1
Hi Vasant,

Bikeshedding a bit but a minor review comment:

"hdata: Make sure FW feature name is not NULL"

I think it should be "not Empty" rather than "not NULL" since you are
checking for length and 'name' and 'feature->name' being a static arrays
wont be NULL.

Vasant Hegde <hegdevasant@linux.vnet.ibm.com> writes:

> CC: Oliver O'Halloran <oohall@gmail.com>
> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> ---
>  hdata/spira.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/hdata/spira.c b/hdata/spira.c
> index c820c4daf..3a26f17ae 100644
> --- a/hdata/spira.c
> +++ b/hdata/spira.c
> @@ -1213,6 +1213,11 @@ static void add_iplparams_features(const struct HDIF_common_hdr *iplp)
>  		name[sizeof(name)-1] = '\0';
>  		flags = be64_to_cpu(feature->flags);
>
> +		if (strlen(name) == 0) {
> +			prlog(PR_DEBUG, "IPLPARAMS: FW feature name is NULL\n");
> +			continue;
> +		}
> +
Stewart Smith Sept. 13, 2018, 8:52 a.m. UTC | #2
Vaibhav Jain <vaibhav@linux.vnet.ibm.com> writes:
> Hi Vasant,
>
> Bikeshedding a bit but a minor review comment:
>
> "hdata: Make sure FW feature name is not NULL"
>
> I think it should be "not Empty" rather than "not NULL" since you are
> checking for length and 'name' and 'feature->name' being a static arrays
> wont be NULL.

Fixed the bikeshed when merging.

Merged to master as of 9d9395c3d542b5b2949b6ba3d5c0a8f1618b77e0
Vasant Hegde Sept. 17, 2018, 8:43 a.m. UTC | #3
On 09/13/2018 02:22 PM, Stewart Smith wrote:
> Vaibhav Jain <vaibhav@linux.vnet.ibm.com> writes:
>> Hi Vasant,
>>
>> Bikeshedding a bit but a minor review comment:
>>
>> "hdata: Make sure FW feature name is not NULL"
>>
>> I think it should be "not Empty" rather than "not NULL" since you are
>> checking for length and 'name' and 'feature->name' being a static arrays
>> wont be NULL.
> 
> Fixed the bikeshed when merging.

Thanks!

-Vasant
diff mbox series

Patch

diff --git a/hdata/spira.c b/hdata/spira.c
index c820c4daf..3a26f17ae 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -1213,6 +1213,11 @@  static void add_iplparams_features(const struct HDIF_common_hdr *iplp)
 		name[sizeof(name)-1] = '\0';
 		flags = be64_to_cpu(feature->flags);
 
+		if (strlen(name) == 0) {
+			prlog(PR_DEBUG, "IPLPARAMS: FW feature name is NULL\n");
+			continue;
+		}
+
 		prlog(PR_DEBUG, "IPLPARAMS: FW feature %s = %016"PRIx64"\n",
 				name, flags);