examples/ipsec-secgw: replace strncpy with strlcpy
PATCH 1/1 examples/ipsec-secgw: replace strncpy with strlcpy
Use strlcpy instead of strncpy.
--- examples/ipsec-secgw/parser.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
examples/ipsec-secgw/parser.c +7 -6
@@ -3,6 +3,7 @@*/ #include <rte_common.h> #include <rte_crypto.h> +#include <rte_string_fns.h> #include <cmdline_parse_string.h> #include <cmdline_parse_num.h>
@@ -212,14 +213,14 @@ parse_ipv4_addr(const char *token, struct in_addr *ipv4, uint32_t *mask) pch =strchr (token,'/' );if (pch !=NULL ) { -strncpy (ip_str, token, pch - token); +strlcpy (ip_str, token, pch - token); pch +=1 ;if (is_str_num (pch) !=0 )return -EINVAL ;if (mask) *mask =atoi (pch); }else { -strncpy (ip_str, token,sizeof (ip_str) -1 ); +strlcpy (ip_str, token,sizeof (ip_str) -1 );if (mask) *mask =0 ; }
@@ -241,14 +242,14 @@ parse_ipv6_addr(const char *token, struct in6_addr *ipv6, uint32_t *mask) pch =strchr (token,'/' );if (pch !=NULL ) { -strncpy (ip_str, token, pch - token); +strlcpy (ip_str, token, pch - token); pch +=1 ;if (is_str_num (pch) !=0 )return -EINVAL ;if (mask) *mask =atoi (pch); }else { -strncpy (ip_str, token,sizeof (ip_str) -1 ); +strlcpy (ip_str, token,sizeof (ip_str) -1 );if (mask) *mask =0 ; }
@@ -515,7 +516,7 @@ parse_cfg_file(const char *cfg_filename) goto error_exit; } -strncpy (str +strlen (str), oneline, +strlcpy (str +strlen (str), oneline,strlen (oneline));continue ;
@@ -528,7 +529,7 @@ parse_cfg_file(const char *cfg_filename) cfg_filename, line_num); goto error_exit; } -strncpy (str +strlen (str), oneline, +strlcpy (str +strlen (str), oneline,strlen (oneline)); str[strlen (str)] ='\n' ;
Signature · 1 line
2.14.3
PATCH 1/1 examples/quota_watermark: fix gcc 8.0.1 cast between incompatible types
Gcc 8.0.1 reports incompatible cast between types i.e. from void (*)(void *) to (int (*)(void *).
Change the pipeline_stage prototype to retun int type to fix the issue.
--- examples/quota_watermark/qw/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
examples/quota_watermark/qw/main.c +7 -3
@@ -181,7 +181,7 @@ receive_stage(__attribute__((unused)) void *args) } } -static void +static int pipeline_stage (__attribute__((unused))void *args) {int i, ret;
@@ -243,9 +243,11 @@ pipeline_stage(__attribute__((unused)) void *args) } } } + +return 0 ; } -static void +static int send_stage (__attribute__((unused))void *args) {uint16_t nb_dq_pkts;
@@ -287,6 +289,8 @@ send_stage(__attribute__((unused)) void *args)/* TODO: Check if nb_dq_pkts == nb_tx_pkts? */ } } + +return 0 ; }int
@@ -347,7 +351,7 @@ main(int argc, char **argv)init_ring (lcore_id, port_id);/* typecast is a workaround for GCC 4.3 bug */ -rte_eal_remote_launch ((int (*)(void *))pipeline_stage, +rte_eal_remote_launch (pipeline_stage,NULL , lcore_id); } }
Signature · 1 line
2.14.3
PATCH 1/1 examples/vhost_scsi: replace strncpy with strlcpy
In reply to Reshma PattanUse strlcpy instead of strncpy.
--- examples/vhost_scsi/scsi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
examples/vhost_scsi/scsi.c +6 -5
@@ -20,6 +20,7 @@#include <rte_log.h> #include <rte_malloc.h> #include <rte_byteorder.h> +#include <rte_string_fns.h> #include "vhost_scsi.h" #include "scsi_spec.h"
@@ -181,7 +182,7 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev,break ;case SPC_VPD_UNIT_SERIAL_NUMBER : hlen =4 ; -strncpy ((char *)vpage->params, bdev->name,32 ); +strlcpy ((char *)vpage->params, bdev->name,32 ); vpage->alloc_len =rte_cpu_to_be_16 (32 );break ;case SPC_VPD_DEVICE_IDENTIFICATION :
@@ -215,10 +216,10 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, desig->piv =1 ; desig->reserved1 =0 ; desig->len =8 +16 +32 ; -strncpy ((char *)desig->desig,"INTEL" ,8 ); +strlcpy ((char *)desig->desig,"INTEL" ,8 );vhost_strcpy_pad ((char *)&desig->desig[8 ], bdev->product_name,16 ,' ' ); -strncpy ((char *)&desig->desig[24 ], bdev->name,32 ); +strlcpy ((char *)&desig->desig[24 ], bdev->name,32 ); len +=sizeof (struct scsi_desig_desc ) +8 +16 +32 ; buf +=sizeof (struct scsi_desig_desc ) + desig->len;
@@ -275,7 +276,7 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, inqdata->flags3 =0x2 ;/* T10 VENDOR IDENTIFICATION */ -strncpy ((char *)inqdata->t10_vendor_id,"INTEL" ,8 ); +strlcpy ((char *)inqdata->t10_vendor_id,"INTEL" ,8 );/* PRODUCT IDENTIFICATION */ snprintf((char *)inqdata->product_id,
@@ -283,7 +284,7 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, bdev->product_name);/* PRODUCT REVISION LEVEL */ -strncpy ((char *)inqdata->product_rev,"0001" ,4 ); +strlcpy ((char *)inqdata->product_rev,"0001" ,4 );/* Standard inquiry data ends here. Only populate * remaining fields if alloc_len indicates enough
Signature · 1 line
2.14.3
Quoted 26 lines · Reshma Pattan
Use strlcpy instead of strncpy.
Fixes 0d547ed037 ("examples/ipsec-secgw: support configuration file")Fixes 07b156199f ("examples/ipsec-secgw: fix configuration string termination")Fixes a1469c319f ("examples/ipsec-secgw: fix configuration parsing")CC Zhang,Roy Fan <[email protected]>Signed-off-by Reshma Pattan <[email protected]>--- examples/ipsec-secgw/parser.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)examples/ipsec-secgw/parser.c +1
-0@@ -3,6 +3,7 @@*/ #include <rte_common.h> #include <rte_crypto.h> +#include <rte_string_fns.h> #include <cmdline_parse_string.h> #include <cmdline_parse_num.h>
examples/ipsec-secgw/parser.c parse_ipv4_addr(const char *token, struct in_addr *ipv4, uint32_t *mask) · line 216
Quoted 5 lines
examples/ipsec-secgw/parser.c +1
-1@@ -212,14 +213,14 @@ parse_ipv4_addr(const char *token, struct in_addr *ipv4, uint32_t *mask) pch =strchr (token,'/' );if (pch !=NULL ) { -strncpy (ip_str, token, pch - token); +strlcpy (ip_str, token, pch - token);
While this is fixing the compiler error, it's not really doing any bounds checking for overflow on the destination buffer. Ideally, the final parameter should be something like:
min(pch - token, sizeof(ip_str))
examples/ipsec-secgw/parser.c parse_ipv4_addr(const char *token, struct in_addr *ipv4, uint32_t *mask) · line 223
Quoted 8 lines
examples/ipsec-secgw/parser.c +1
-1pch +=1 ;if (is_str_num (pch) !=0 )return -EINVAL ;if (mask) *mask =atoi (pch); }else { -strncpy (ip_str, token,sizeof (ip_str) -1 ); +strlcpy (ip_str, token,sizeof (ip_str) -1 );
Since the original code was using strncpy, it's possible the "- 1" was an incorrect attempt to make strncpy safe. Therefore, did you check to see if it's possible to drop the -1 in the strlcpy case?
examples/ipsec-secgw/parser.c parse_ipv6_addr(const char *token, struct in6_addr *ipv6, uint32_t *mask) · line 245
Quoted 9 lines
examples/ipsec-secgw/parser.c +1
-1if (mask) *mask =0 ; }@@ -241,14 +242,14 @@ parse_ipv6_addr(const char *token, struct in6_addr *ipv6, uint32_t *mask) pch =strchr (token,'/' );if (pch !=NULL ) { -strncpy (ip_str, token, pch - token); +strlcpy (ip_str, token, pch - token);
As before, this doesn't do proper bounds checking.
examples/ipsec-secgw/parser.c parse_ipv4_addr(const char *token, struct in_addr *ipv4, uint32_t *mask) · line 223
Quoted 8 lines
examples/ipsec-secgw/parser.c +1
-1pch +=1 ;if (is_str_num (pch) !=0 )return -EINVAL ;if (mask) *mask =atoi (pch); }else { -strncpy (ip_str, token,sizeof (ip_str) -1 ); +strlcpy (ip_str, token,sizeof (ip_str) -1 );
As before, can we remove the -1?
examples/ipsec-secgw/parser.c parse_cfg_file(const char *cfg_filename) · line 520
Quoted 10 lines
examples/ipsec-secgw/parser.c +1
-1if (mask) *mask =0 ; }@@ -515,7 +516,7 @@ parse_cfg_file(const char *cfg_filename) goto error_exit; } -strncpy (str +strlen (str), oneline, +strlcpy (str +strlen (str), oneline,strlen (oneline));
This doesn't do bounds checking, and since it just uses strlen to find the bounds it can just be replaced by a strcpy() - which will also be more efficient too, since it would only scan the string once, rather than twice as here.
So, either add in a proper bounds check on the destination buffer, or if a bounds check is not necessary, just replace with strcpy to show its not actually needing a bounds check.
examples/ipsec-secgw/parser.c parse_cfg_file(const char *cfg_filename) · line 533
Quoted 9 lines
examples/ipsec-secgw/parser.c +1
-1continue ;@@ -528,7 +529,7 @@ parse_cfg_file(const char *cfg_filename) cfg_filename, line_num); goto error_exit; } -strncpy (str +strlen (str), oneline, +strlcpy (str +strlen (str), oneline,strlen (oneline));
As above.
Quoted 5 lines
examples/ipsec-secgw/parser.c +0
-0str[strlen (str)] ='\n' ;Signature · 1 line
2.14.3
Re: [PATCH] examples/vhost_scsi: replace strncpy with strlcpy
In reply to Reshma PattanQuoted 55 lines · Reshma Pattan
Use strlcpy instead of strncpy.
Fixes db75c7af19 ("examples/vhost_scsi: introduce a new sample app")Signed-off-by Reshma Pattan <[email protected]>--- examples/vhost_scsi/scsi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)examples/vhost_scsi/scsi.c +5
-4@@ -20,6 +20,7 @@#include <rte_log.h> #include <rte_malloc.h> #include <rte_byteorder.h> +#include <rte_string_fns.h> #include "vhost_scsi.h" #include "scsi_spec.h" @@ -181,7 +182,7 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev,break ;case SPC_VPD_UNIT_SERIAL_NUMBER : hlen =4 ; -strncpy ((char *)vpage->params, bdev->name,32 ); +strlcpy ((char *)vpage->params, bdev->name,32 ); vpage->alloc_len =rte_cpu_to_be_16 (32 );break ;case SPC_VPD_DEVICE_IDENTIFICATION :@@ -215,10 +216,10 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, desig->piv =1 ; desig->reserved1 =0 ; desig->len =8 +16 +32 ; -strncpy ((char *)desig->desig,"INTEL" ,8 ); +strlcpy ((char *)desig->desig,"INTEL" ,8 );vhost_strcpy_pad ((char *)&desig->desig[8 ], bdev->product_name,16 ,' ' ); -strncpy ((char *)&desig->desig[24 ], bdev->name,32 ); +strlcpy ((char *)&desig->desig[24 ], bdev->name,32 ); len +=sizeof (struct scsi_desig_desc ) +8 +16 +32 ; buf +=sizeof (struct scsi_desig_desc ) + desig->len;@@ -275,7 +276,7 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, inqdata->flags3 =0x2 ;/* T10 VENDOR IDENTIFICATION */ -strncpy ((char *)inqdata->t10_vendor_id,"INTEL" ,8 ); +strlcpy ((char *)inqdata->t10_vendor_id,"INTEL" ,8 );/* PRODUCT IDENTIFICATION */ snprintf((char *)inqdata->product_id,
examples/vhost_scsi/scsi.c vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, · line 290
Quoted 8 lines
examples/vhost_scsi/scsi.c +1
-1@@ -283,7 +284,7 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, bdev->product_name);/* PRODUCT REVISION LEVEL */ -strncpy ((char *)inqdata->product_rev,"0001" ,4 ); +strlcpy ((char *)inqdata->product_rev,"0001" ,4 );/* Standard inquiry data ends here. Only populate * remaining fields if alloc_len indicates enough
Can the magic numbers "32", "8", "4" be replaced with non-magic values, e.g. sizeof(...).
/Bruce
PATCH v2 1/1 examples/ipsec-secgw: replace strncpy with strlcpy
In reply to Reshma PattanUse strlcpy instead of strncpy.
Use strcpy where boundchecks on destination is not needed.
---
v2: use destination based boundary checks in strlcpy.
--- examples/ipsec-secgw/parser.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
examples/ipsec-secgw/parser.c +10 -10
@@ -3,6 +3,7 @@*/ #include <rte_common.h> #include <rte_crypto.h> +#include <rte_string_fns.h> #include <cmdline_parse_string.h> #include <cmdline_parse_num.h>
@@ -207,19 +208,20 @@ inet_pton6(const char *src, unsigned char *dst)int parse_ipv4_addr (const char *token,struct in_addr *ipv4,uint32_t *mask) { -char ip_str[256 ] = {0 }; +char ip_str[INET_ADDRSTRLEN ] = {0 };char *pch; pch =strchr (token,'/' );if (pch !=NULL ) { -strncpy (ip_str, token, pch - token); +strlcpy (ip_str, token,RTE_MIN ((long unsigned int )(pch - token), +sizeof (ip_str))); pch +=1 ;if (is_str_num (pch) !=0 )return -EINVAL ;if (mask) *mask =atoi (pch); }else { -strncpy (ip_str, token,sizeof (ip_str) -1 ); +strlcpy (ip_str, token,sizeof (ip_str));if (mask) *mask =0 ; }
@@ -241,14 +243,15 @@ parse_ipv6_addr(const char *token, struct in6_addr *ipv6, uint32_t *mask) pch =strchr (token,'/' );if (pch !=NULL ) { -strncpy (ip_str, token, pch - token); +strlcpy (ip_str, token,RTE_MIN ((long unsigned int )(pch - token), +sizeof (ip_str))); pch +=1 ;if (is_str_num (pch) !=0 )return -EINVAL ;if (mask) *mask =atoi (pch); }else { -strncpy (ip_str, token,sizeof (ip_str) -1 ); +strlcpy (ip_str, token,sizeof (ip_str));if (mask) *mask =0 ; }
@@ -515,9 +518,7 @@ parse_cfg_file(const char *cfg_filename) goto error_exit; } -strncpy (str +strlen (str), oneline, -strlen (oneline)); - +strcpy (str +strlen (str), oneline);continue ; }
@@ -528,8 +529,7 @@ parse_cfg_file(const char *cfg_filename) cfg_filename, line_num); goto error_exit; } -strncpy (str +strlen (str), oneline, -strlen (oneline)); +strcpy (str +strlen (str), oneline); str[strlen (str)] ='\n' ;if (cmdline_parse (cl, str) <0 ) {
Signature · 1 line
2.17.0
PATCH v3 1/1 examples/ipsec-secgw: replace strncpy with strlcpy
Use strlcpy instead of strncpy.
Use strcpy where boundchecks on destination is not needed.
---
v3: fix checkpatch warnings.
--- examples/ipsec-secgw/parser.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
examples/ipsec-secgw/parser.c +10 -10
@@ -3,6 +3,7 @@*/ #include <rte_common.h> #include <rte_crypto.h> +#include <rte_string_fns.h> #include <cmdline_parse_string.h> #include <cmdline_parse_num.h>
@@ -207,19 +208,20 @@ inet_pton6(const char *src, unsigned char *dst)int parse_ipv4_addr (const char *token,struct in_addr *ipv4,uint32_t *mask) { -char ip_str[256 ] = {0 }; +char ip_str[INET_ADDRSTRLEN ] = {0 };char *pch; pch =strchr (token,'/' );if (pch !=NULL ) { -strncpy (ip_str, token, pch - token); +strlcpy (ip_str, token,RTE_MIN ((unsigned int long )(pch - token), +sizeof (ip_str))); pch +=1 ;if (is_str_num (pch) !=0 )return -EINVAL ;if (mask) *mask =atoi (pch); }else { -strncpy (ip_str, token,sizeof (ip_str) -1 ); +strlcpy (ip_str, token,sizeof (ip_str));if (mask) *mask =0 ; }
@@ -241,14 +243,15 @@ parse_ipv6_addr(const char *token, struct in6_addr *ipv6, uint32_t *mask) pch =strchr (token,'/' );if (pch !=NULL ) { -strncpy (ip_str, token, pch - token); +strlcpy (ip_str, token,RTE_MIN ((unsigned int long )(pch - token), +sizeof (ip_str))); pch +=1 ;if (is_str_num (pch) !=0 )return -EINVAL ;if (mask) *mask =atoi (pch); }else { -strncpy (ip_str, token,sizeof (ip_str) -1 ); +strlcpy (ip_str, token,sizeof (ip_str));if (mask) *mask =0 ; }
@@ -515,9 +518,7 @@ parse_cfg_file(const char *cfg_filename) goto error_exit; } -strncpy (str +strlen (str), oneline, -strlen (oneline)); - +strcpy (str +strlen (str), oneline);continue ; }
@@ -528,8 +529,7 @@ parse_cfg_file(const char *cfg_filename) cfg_filename, line_num); goto error_exit; } -strncpy (str +strlen (str), oneline, -strlen (oneline)); +strcpy (str +strlen (str), oneline); str[strlen (str)] ='\n' ;if (cmdline_parse (cl, str) <0 ) {
Signature · 1 line
2.17.0
Re: [PATCH] examples/vhost_scsi: replace strncpy with strlcpy
In reply to Bruce RichardsonHi Bruce,
Quoted 26 lines
-----Original Message-----
From: Richardson, Bruce
Sent: Wednesday, May 9, 2018 2:37 PM
To: Pattan, Reshma <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH] examples/vhost_scsi: replace strncpy with strlcpyQuoted 17 lines · Reshma Pattan
Use strlcpy instead of strncpy.
Fixes db75c7af19 ("examples/vhost_scsi: introduce a new sample app")Signed-off-by Reshma Pattan <[email protected]>---
examples/vhost_scsi/scsi.c +3
-3-strncpy ((char *)vpage->params, bdev->name,32 ); +strlcpy ((char *)vpage->params, bdev->name,32 ); -strncpy ((char *)desig->desig,"INTEL" ,8 ); +strlcpy ((char *)desig->desig,"INTEL" ,8 );vhost_strcpy_pad ((char *)&desig->desig[8 ], bdev->product_name,16 ,' ' ); -strncpy ((char *)&desig->desig[24 ], bdev->name,32 ); +strlcpy ((char *)&desig->desig[24 ], bdev->name,32 );
Quoted 4 lines
Quoted 1 line
--
Can the magic numbers "32", "8", "4" be replaced with non-magic values, e.g. sizeof(...).
If I take below piece of code as example , the application is trying to copy
below strings to bare array which has no size defined to it.
Neither there are any variable like brand name or device name available in desig object which of type struct scsi_desig_desc, which I can use to pass on to sizeof() for using it for strlcpy. So not sure how to do address the comment of using sizeof(). Any suggestions?
strlcpy((char *)desig->desig, "INTEL", 8);
strlcpy((char *)&desig->desig[24], bdev->name, 32);/* designation descriptor */
struct scsi_desig_desc {uint8_t code_set>*******: 4;uint8_t protocol_id>****: 4;uint8_t type>***>*******: 4;uint8_t association>****: 2;uint8_t reserved0>******: 1;uint8_t piv>****>*******: 1;uint8_t reserved1;
uint8_t>len;uint8_t desig[];
};
Thanks,
Reshma
PATCH v2 1/1 examples/vhost_scsi: replace strncpy with strlcpy
In reply to Reshma PattanUse strlcpy instead of strncpy.
---
v2: replace magic numbers with sizeof() wherever possible.
--- examples/vhost_scsi/scsi.c | 14 +++++++++----- examples/vhost_scsi/scsi_spec.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-)
examples/vhost_scsi/scsi.c +9 -5
@@ -20,6 +20,7 @@#include <rte_log.h> #include <rte_malloc.h> #include <rte_byteorder.h> +#include <rte_string_fns.h> #include "vhost_scsi.h" #include "scsi_spec.h"
@@ -181,7 +182,8 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev,break ;case SPC_VPD_UNIT_SERIAL_NUMBER : hlen =4 ; -strncpy ((char *)vpage->params, bdev->name,32 ); +strlcpy ((char *)vpage->params, bdev->name, +sizeof (vpage->params)); vpage->alloc_len =rte_cpu_to_be_16 (32 );break ;case SPC_VPD_DEVICE_IDENTIFICATION :
@@ -215,10 +217,10 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, desig->piv =1 ; desig->reserved1 =0 ; desig->len =8 +16 +32 ; -strncpy ((char *)desig->desig,"INTEL" ,8 ); +strlcpy ((char *)desig->desig,"INTEL" ,8 );vhost_strcpy_pad ((char *)&desig->desig[8 ], bdev->product_name,16 ,' ' ); -strncpy ((char *)&desig->desig[24 ], bdev->name,32 ); +strlcpy ((char *)&desig->desig[24 ], bdev->name,32 ); len +=sizeof (struct scsi_desig_desc ) +8 +16 +32 ; buf +=sizeof (struct scsi_desig_desc ) + desig->len;
@@ -275,7 +277,8 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, inqdata->flags3 =0x2 ;/* T10 VENDOR IDENTIFICATION */ -strncpy ((char *)inqdata->t10_vendor_id,"INTEL" ,8 ); +strlcpy ((char *)inqdata->t10_vendor_id,"INTEL" , +sizeof (inqdata->t10_vendor_id));/* PRODUCT IDENTIFICATION */ snprintf((char *)inqdata->product_id,
@@ -283,7 +286,8 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, bdev->product_name);/* PRODUCT REVISION LEVEL */ -strncpy ((char *)inqdata->product_rev,"0001" ,4 ); +strlcpy ((char *)inqdata->product_rev,"0001" , +sizeof (inqdata->product_rev));/* Standard inquiry data ends here. Only populate * remaining fields if alloc_len indicates enough
examples/vhost_scsi/scsi_spec.h +1 -1
@@ -367,7 +367,7 @@ struct scsi_vpd_page {uint8_t peripheral;uint8_t page_code;uint16_t alloc_len; -uint8_t params[]; +uint8_t params[32 ]; };#define SCSI_VEXT_REF_CHK 0x01
Signature · 1 line
2.17.0
Re: [PATCH] examples/vhost_scsi: replace strncpy with strlcpy
In reply to Bruce RichardsonHi Bruce,
Quoted 3 lines
Can the magic numbers "32", "8", "4" be replaced with non-magic values, e.g. sizeof(...).
This is now taken care wherever possible in latest patch.
Thanks,
Reshma
Quoted 1 line
/Bruce
Re: [PATCH v2] examples/vhost_scsi: replace strncpy with strlcpy
In reply to Reshma PattanQuoted 5 lines · Reshma Pattan
Use strlcpy instead of strncpy.
Fixes db75c7af19 ("examples/vhost_scsi: introduce a new sample app")
Quoted 8 lines
Signed-off-by Reshma Pattan <[email protected]>---
v2: replace magic numbers withsizeof()wherever possible.--- examples/vhost_scsi/scsi.c | 14 +++++++++----- examples/vhost_scsi/scsi_spec.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-)
Looks better now, thanks.
Re: [dpdk-stable] [PATCH] examples/quota_watermark: fix gcc 8.0.1 cast between incompatible types
In reply to Reshma PattanQuoted 13 lines
-----Original Message-----
From: stable [mailto:[email protected]] On Behalf Of Reshma Pattan
Sent: Wednesday, May 9, 2018 12:35 PM
To: [email protected]
Cc: [email protected]; Pattan, Reshma <[email protected]>
Subject: [dpdk-stable] [PATCH] examples/quota_watermark: fix gcc 8.0.1 cast between incompatible typesGcc 8.0.1 reports incompatible cast between types i.e. from
void (*)(void *)to(int (*)(void *).
Quoted 6 lines
Change the
pipeline_stageprototype to retun int type to fix the issue.Fixes a0ffcb257a ("examples/quota_watermark: correct code indentation")Signed-off-by Reshma Pattan <[email protected]>
Quoted 15 lines
-----Original Message-----
From: stable [mailto:[email protected]] On Behalf Of Reshma Pattan
Sent: Wednesday, May 9, 2018 5:11 PM
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; [email protected]; Zhang, Roy Fan <[email protected]>; Pattan, Reshma <[email protected]>
Subject: [dpdk-stable] [PATCH v3] examples/ipsec-secgw: replace strncpy with strlcpyUse strlcpy instead of strncpy.
Use strcpy where boundchecks on destination is not needed.
Quoted 8 lines
Fixes 0d547ed037 ("examples/ipsec-secgw: support configuration file")Fixes 07b156199f ("examples/ipsec-secgw: fix configuration stringtermination")
Fixes a1469c319f ("examples/ipsec-secgw: fix configuration parsing")CC Zhang,Roy Fan <[email protected]>Signed-off-by Reshma Pattan <[email protected]>
Re: [dpdk-stable] [PATCH] examples/quota_watermark: fix gcc 8.0.1 cast between incompatible types
In reply to Reshma Pattan09/05/2018 13:35, Reshma Pattan:
Quoted 11 lines
Gcc 8.0.1 reports incompatible cast between types i.e. from
void (*)(void *)to(int (*)(void *).Change the
pipeline_stageprototype to retun int type to fix the issue.Fixes a0ffcb257a ("examples/quota_watermark: correct code indentation")Signed-off-by Reshma Pattan <[email protected]>---
examples/quota_watermark/qw/main.c main(int argc, char **argv) · line 355
Quoted 4 lines
examples/quota_watermark/qw/main.c +1
-1/* typecast is a workaround for GCC 4.3 bug */ -rte_eal_remote_launch ((int (*)(void *))pipeline_stage, +rte_eal_remote_launch (pipeline_stage,NULL , lcore_id);
The comment can be removed.
Applied with above fixed, thanks
Thomas Monjalon
AppliedRe: [PATCH v2] examples/vhost_scsi: replace strncpy with strlcpy
In reply to Bruce Richardson10/05/2018 15:31, Bruce Richardson:
Quoted 14 lines · Reshma Pattan
Quoted 5 lines
Use strlcpy instead of strncpy.
Fixes db75c7af19 ("examples/vhost_scsi: introduce a new sample app")Quoted 8 lines
Signed-off-by Reshma Pattan <[email protected]>---
v2: replace magic numbers withsizeof()wherever possible.--- examples/vhost_scsi/scsi.c | 14 +++++++++----- examples/vhost_scsi/scsi_spec.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-)
Quoted 2 lines
Looks better now, thanks.
Acked-by Bruce Richardson <[email protected]>
Applied, thanks
Thomas Monjalon
AppliedQuoted 10 lines
Quoted 10 lines
Use strlcpy instead of strncpy.
Use strcpy where boundchecks on destination is not needed.Fixes 0d547ed037 ("examples/ipsec-secgw: support configuration file")Fixes 07b156199f ("examples/ipsec-secgw: fix configuration stringtermination")
Fixes a1469c319f ("examples/ipsec-secgw: fix configuration parsing")CC Zhang,Roy Fan <[email protected]>
Quoted 3 lines
Quoted 1 line
Signed-off-by Reshma Pattan <[email protected]>Acked-by Pablo de Lara <[email protected]>
Applied, thanks