[Skiboot] [PATCH 2/6] check for NULL input string in is_sai_loc_code
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Mon May 21 19:00:54 AEST 2018
On 05/18/2018 05:01 AM, Balbir singh wrote:
> Caught by scan-build, also constant-ify the input
> parameter.
>
> Signed-off-by: Balbir singh <bsingharora at gmail.com>
Reviewed-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
-Vasant
> ---
> hw/fsp/fsp-leds.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
> index 0fe03094..9040c0a4 100644
> --- a/hw/fsp/fsp-leds.c
> +++ b/hw/fsp/fsp-leds.c
> @@ -203,9 +203,12 @@ static inline void opal_led_update_complete(u64 async_token, u64 result)
> opal_queue_msg(OPAL_MSG_ASYNC_COMP, NULL, NULL, async_token, result);
> }
>
> -static inline bool is_sai_loc_code(char *loc_code)
> +static inline bool is_sai_loc_code(const char *loc_code)
> {
> - if (!strcmp(sai_data.loc_code, loc_code))
> + if (!loc_code)
> + return false;
> +
> + if (!strncmp(sai_data.loc_code, loc_code, strlen(sai_data.loc_code)))
> return true;
>
> return false;
>
More information about the Skiboot
mailing list