diff mbox

example: classifier: check for null token

Message ID 1431638585-13524-1-git-send-email-mike.holmes@linaro.org
State New
Headers show

Commit Message

Mike Holmes May 14, 2015, 9:23 p.m. UTC
fixes https://bugs.linaro.org/show_bug.cgi?id=1534

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---

The case  sudo ./example/classifier/odp_classifier -i eth0 -m 0 -p ""
now returns
odp_classifier.c:599:parse_pmr_policy():Invalid ODP_PMR_TERM string

 example/classifier/odp_classifier.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Balasubramanian Manoharan May 15, 2015, 6:08 a.m. UTC | #1
Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

On 15 May 2015 at 02:53, Mike Holmes <mike.holmes@linaro.org> wrote:
> fixes https://bugs.linaro.org/show_bug.cgi?id=1534
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>
> The case  sudo ./example/classifier/odp_classifier -i eth0 -m 0 -p ""
> now returns
> odp_classifier.c:599:parse_pmr_policy():Invalid ODP_PMR_TERM string
>
>  example/classifier/odp_classifier.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
> index d78eb7b..3cc6738 100644
> --- a/example/classifier/odp_classifier.c
> +++ b/example/classifier/odp_classifier.c
> @@ -559,6 +559,9 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len)
>
>  static int convert_str_to_pmr_enum(char *token, odp_pmr_term_e *term)
>  {
> +       if (NULL == token)
> +               return -1;
> +
>         if (0 == strcasecmp(token, "ODP_PMR_SIP_ADDR")) {
>                 *term = ODP_PMR_SIP_ADDR;
>                 return 0;
> --
> 2.1.4
>
Maxim Uvarov May 18, 2015, 10:38 a.m. UTC | #2
Merged,
Thanks.

On 05/15/2015 09:08, Bala Manoharan wrote:
> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>
> On 15 May 2015 at 02:53, Mike Holmes <mike.holmes@linaro.org> wrote:
>> fixes https://bugs.linaro.org/show_bug.cgi?id=1534
>>
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>> ---
>>
>> The case  sudo ./example/classifier/odp_classifier -i eth0 -m 0 -p ""
>> now returns
>> odp_classifier.c:599:parse_pmr_policy():Invalid ODP_PMR_TERM string
>>
>>   example/classifier/odp_classifier.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
>> index d78eb7b..3cc6738 100644
>> --- a/example/classifier/odp_classifier.c
>> +++ b/example/classifier/odp_classifier.c
>> @@ -559,6 +559,9 @@ static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len)
>>
>>   static int convert_str_to_pmr_enum(char *token, odp_pmr_term_e *term)
>>   {
>> +       if (NULL == token)
>> +               return -1;
>> +
>>          if (0 == strcasecmp(token, "ODP_PMR_SIP_ADDR")) {
>>                  *term = ODP_PMR_SIP_ADDR;
>>                  return 0;
>> --
>> 2.1.4
>>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index d78eb7b..3cc6738 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -559,6 +559,9 @@  static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len)
 
 static int convert_str_to_pmr_enum(char *token, odp_pmr_term_e *term)
 {
+	if (NULL == token)
+		return -1;
+
 	if (0 == strcasecmp(token, "ODP_PMR_SIP_ADDR")) {
 		*term = ODP_PMR_SIP_ADDR;
 		return 0;