[PATCH] lib: string.c: A speed optimized for strncpy

2014-10-05 Thread Rickard Strandqvist
This variant is in my tests about 7-10% faster, and I also think it is perhaps even clearer code than before. I assume that more will do the testing, I do not know if we should do tests on different types of hardware as well, my test was on a new Intel I7. Rickard Strandqvist (1): lib

[PATCH] lib: string.c: A speed optimized for strncpy

2014-10-05 Thread Rickard Strandqvist
This variant is in my tests about 7-10% faster, and also think it is perhaps even clearer code than before. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- lib/string.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/string.c b

Re: [PATCH] lib: string.c: A speed optimized for strncpy

2014-10-05 Thread Rickard Strandqvist
Hi Yes, it can be faster, even if it is as you say, probably a difference depending on the size of the count. And even greater need to test this on a variety of hardware :-/ But I try to do my test with the memset variant to. Kind regards Rickard Strandqvist 2014-10-05 17:36 GMT+02:00 Joe

[PATCH] gpu: drm: drm_dp_mst_topology.c: Fix improper use of strncat.

2014-10-05 Thread Rickard Strandqvist
I have now eliminate the need to use the temporary string, and therefore also the use of strncat. And I think this code is clearer and more effective. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/gpu/drm/drm_dp_mst_topology.c | 15 --- 1

Re: [PATCH] lib: string.c: Added a funktion function strzcpy

2014-09-24 Thread Rickard Strandqvist
2014-09-24 23:26 GMT+02:00 Andrew Morton : > On Wed, 24 Sep 2014 22:51:14 +0200 Rickard Strandqvist > wrote: > >> 2014-09-24 17:41 GMT+02:00 Dan Carpenter : >> > On Wed, Sep 24, 2014 at 07:35:55AM -0700, Andi Kleen wrote: >> >> On Wed, Sep 24, 2014 at 1

Re: [PATCH] lib: string.c: Added a funktion function strzcpy

2014-09-24 Thread Rickard Strandqvist
re were > definitely other places that rely strncpy() padding before. > > regards, > dan carpenter Hi If you want to see examples of this type of error, you can check the patches I've done over the past two months. So in linux-next git log --patch-with-stat And search for

Re: [PATCH] lib: string.c: Added a funktion function strzcpy

2014-09-24 Thread Rickard Strandqvist
, Rickard Strandqvist wrote: Added a function strzcpy which works the same as strncpy, but guaranteed to produce the trailing null character. Do we really need the bizarre strncpy padding semantics for anything? Why not just use strlcpy? We do need the padding in many places

Re: [PATCH] lib: string.c: Added a funktion function strzcpy

2014-09-24 Thread Rickard Strandqvist
2014-09-24 23:26 GMT+02:00 Andrew Morton a...@linux-foundation.org: On Wed, 24 Sep 2014 22:51:14 +0200 Rickard Strandqvist rickard_strandqv...@spectrumdigital.se wrote: 2014-09-24 17:41 GMT+02:00 Dan Carpenter dan.carpen...@oracle.com: On Wed, Sep 24, 2014 at 07:35:55AM -0700, Andi Kleen

[PATCH] lib: string.c: Added a funktion function strzcpy

2014-09-23 Thread Rickard Strandqvist
was thinking of making it with the return value corresponding to strlen, but could not make any neat/optimal solution. But if we are to add this maybe it's worth thinking about whether we can use the return value to something sensible. Rickard Strandqvist (1): lib: string.c: Added a funktion

[PATCH] lib: string.c: Added a funktion function strzcpy

2014-09-23 Thread Rickard Strandqvist
Added a function strzcpy which works the same as strncpy, but guaranteed to produce the trailing null character. Signed-off-by: Rickard Strandqvist --- include/linux/string.h |1 + lib/string.c | 31 +++ 2 files changed, 32 insertions(+) diff --git

[PATCH] lib: string.c: Added a funktion function strzcpy

2014-09-23 Thread Rickard Strandqvist
was thinking of making it with the return value corresponding to strlen, but could not make any neat/optimal solution. But if we are to add this maybe it's worth thinking about whether we can use the return value to something sensible. Rickard Strandqvist (1): lib: string.c: Added a funktion

[PATCH] lib: string.c: Added a funktion function strzcpy

2014-09-23 Thread Rickard Strandqvist
Added a function strzcpy which works the same as strncpy, but guaranteed to produce the trailing null character. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- include/linux/string.h |1 + lib/string.c | 31 +++ 2 files

Re: [PATCH] staging: lustre: lustre: libcfs: debug.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-18 Thread Rickard Strandqvist
2014-09-18 10:51 GMT+02:00 Dan Carpenter : > On Thu, Sep 18, 2014 at 12:12:42AM +0200, Rickard Strandqvist wrote: >> Hi Dan >> >> Ok, I have made two suggestions for strncpy function that also >> guarantees a terminating null character. >> 1) retunerar number o

Re: [PATCH] staging: lustre: lustre: libcfs: debug.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-18 Thread Rickard Strandqvist
2014-09-18 10:51 GMT+02:00 Dan Carpenter dan.carpen...@oracle.com: On Thu, Sep 18, 2014 at 12:12:42AM +0200, Rickard Strandqvist wrote: Hi Dan Ok, I have made two suggestions for strncpy function that also guarantees a terminating null character. 1) retunerar number of characters

Re: [PATCH] staging: lustre: lustre: libcfs: debug.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-17 Thread Rickard Strandqvist
2014-09-15 10:23 GMT+02:00 Dan Carpenter : > On Sun, Sep 14, 2014 at 06:03:16PM +0200, Rickard Strandqvist wrote: >> Using memset before strncpy just to ensure a trailing null >> character is an unnecessary double writing of a string >> > > You really should make a

Re: [PATCH] staging: lustre: lustre: libcfs: debug.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-17 Thread Rickard Strandqvist
2014-09-15 10:23 GMT+02:00 Dan Carpenter dan.carpen...@oracle.com: On Sun, Sep 14, 2014 at 06:03:16PM +0200, Rickard Strandqvist wrote: Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string You really should make a function which

Re: [PATCH] net: can: usb: peak_usb: pcan_usb_core.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-15 Thread Rickard Strandqvist
2014-09-15 10:47 GMT+02:00 David Laight : > From: Marc Kleine-Budde [ >> On 09/15/2014 10:28 AM, David Laight wrote: >> > From: Rickard Strandqvist >> > ... >> >> Replacing strncpy with strlcpy to avoid strings that lacks null terminate. >> > ...

Re: [PATCH] scsi: scsi_devinfo.c: Cleaning up unnecessarily complicated in conjunction with strncpy

2014-09-15 Thread Rickard Strandqvist
2014-09-15 0:38 GMT+02:00 Elliott, Robert (Server Storage) : > > >> -Original Message----- >> From: Rickard Strandqvist [mailto:rickard_strandqv...@spectrumdigital.se] >> How do you mean? >> >> strncpy zeroes throughout the remainder of the string &quo

Re: [PATCH] scsi: scsi_devinfo.c: Cleaning up unnecessarily complicated in conjunction with strncpy

2014-09-15 Thread Rickard Strandqvist
2014-09-15 0:38 GMT+02:00 Elliott, Robert (Server Storage) elli...@hp.com: -Original Message- From: Rickard Strandqvist [mailto:rickard_strandqv...@spectrumdigital.se] How do you mean? strncpy zeroes throughout the remainder of the string from until the length off to_length

Re: [PATCH] net: can: usb: peak_usb: pcan_usb_core.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-15 Thread Rickard Strandqvist
2014-09-15 10:47 GMT+02:00 David Laight david.lai...@aculab.com: From: Marc Kleine-Budde [ On 09/15/2014 10:28 AM, David Laight wrote: From: Rickard Strandqvist ... Replacing strncpy with strlcpy to avoid strings that lacks null terminate. ... diff --git a/drivers/net/can/usb/peak_usb

Re: [PATCH] scsi: scsi_devinfo.c: Cleaning up unnecessarily complicated in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
2014-09-14 23:34 GMT+02:00 Elliott, Robert (Server Storage) : > > >> -Original Message- >> From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi- >> ow...@vger.kernel.org] On Behalf Of Rickard Strandqvist > ... >> diff --git a/drivers/scsi/scsi_devinf

[PATCH] scsi: qla2xxx: qla_mr.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist --- drivers/scsi/qla2xxx/qla_mr.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c

[PATCH] scsi: qla2xxx: qla_gs.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist --- drivers/scsi/qla2xxx/qla_gs.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi

[PATCH] scsi: scsi_devinfo.c: Cleaning up unnecessarily complicated in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
I have revamped the code so it becomes both more effective and far more clear. Signed-off-by: Rickard Strandqvist --- drivers/scsi/scsi_devinfo.c | 31 +++ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi

[PATCH] video: fbdev: sis: sis_main.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist --- drivers/video/fbdev/sis/sis_main.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c

[PATCH] net: ethernet: neterion: vxge: vxge-main.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist --- drivers/net/ethernet/neterion/vxge/vxge-main.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net

[PATCH] net: ethernet: marvell: sky2.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist --- drivers/net/ethernet/marvell/sky2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c

[PATCH] net: ethernet: freescale: fec_main.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist --- drivers/net/ethernet/freescale/fec_main.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net

[PATCH] net: can: usb: peak_usb: pcan_usb_core.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist --- drivers/net/can/usb/peak_usb/pcan_usb_core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can

[PATCH] net: can: sja1000: peak_pcmcia.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist --- drivers/net/can/sja1000/peak_pcmcia.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/sja1000/peak_pcmcia.c b/drivers/net/can/sja1000

Re: [PATCH] isdn: act2000: capi.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
2014-09-14 18:01 GMT+02:00 Rickard Strandqvist : > Using memset before strncpy just to ensure a trailing null > character is an unnecessary double writing of a string > > Signed-off-by: Rickard Strandqvist > --- > drivers/isdn/act2000/capi.c |8 > 1 file change

[PATCH] staging: wlan-ng: prism2fw.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist --- drivers/staging/wlan-ng/prism2fw.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wlan-ng/prism2fw.c

[PATCH] staging: lustre: lustre: libcfs: debug.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist --- drivers/staging/lustre/lustre/libcfs/debug.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre

[PATCH] parisc: pdc_stable.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist --- drivers/parisc/pdc_stable.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/parisc/pdc_stable.c b/drivers

[PATCH] isdn: act2000: capi.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist --- drivers/isdn/act2000/capi.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/isdn/act2000/capi.c b

[PATCH] block: cciss.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist --- drivers/block/cciss.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c

[PATCH] block: cciss.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/block/cciss.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers

[PATCH] isdn: act2000: capi.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/isdn/act2000/capi.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH] parisc: pdc_stable.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/parisc/pdc_stable.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH] staging: lustre: lustre: libcfs: debug.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/staging/lustre/lustre/libcfs/debug.c |2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH] staging: wlan-ng: prism2fw.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/staging/wlan-ng/prism2fw.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH] isdn: act2000: capi.c: Cleaning up unnecessary use of memset in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
2014-09-14 18:01 GMT+02:00 Rickard Strandqvist rickard_strandqv...@spectrumdigital.se: Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/isdn

[PATCH] net: can: sja1000: peak_pcmcia.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/can/sja1000/peak_pcmcia.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/sja1000

[PATCH] net: can: usb: peak_usb: pcan_usb_core.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/can/usb/peak_usb/pcan_usb_core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/usb

[PATCH] net: ethernet: freescale: fec_main.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/ethernet/freescale/fec_main.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet

[PATCH] net: ethernet: marvell: sky2.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/ethernet/marvell/sky2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/sky2.c

[PATCH] net: ethernet: neterion: vxge: vxge-main.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/ethernet/neterion/vxge/vxge-main.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet

[PATCH] video: fbdev: sis: sis_main.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/video/fbdev/sis/sis_main.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/sis/sis_main.c b

[PATCH] scsi: scsi_devinfo.c: Cleaning up unnecessarily complicated in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
I have revamped the code so it becomes both more effective and far more clear. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/scsi/scsi_devinfo.c | 31 +++ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/drivers

[PATCH] scsi: qla2xxx: qla_gs.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/scsi/qla2xxx/qla_gs.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git

[PATCH] scsi: qla2xxx: qla_mr.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/scsi/qla2xxx/qla_mr.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qla2xxx

Re: [PATCH] scsi: scsi_devinfo.c: Cleaning up unnecessarily complicated in conjunction with strncpy

2014-09-14 Thread Rickard Strandqvist
2014-09-14 23:34 GMT+02:00 Elliott, Robert (Server Storage) elli...@hp.com: -Original Message- From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi- ow...@vger.kernel.org] On Behalf Of Rickard Strandqvist ... diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi

Re: [PATCH] infiniband: hw: cxgb3: cxio_hal.c: Cleaning up missing null-terminate after strncpy call

2014-08-18 Thread Rickard Strandqvist
2014-08-18 16:27 GMT+02:00 Steve Wise : > > >> -Original Message- >> From: linux-kernel-ow...@vger.kernel.org >> [mailto:linux-kernel-ow...@vger.kernel.org] >> On Behalf Of Rickard Strandqvist >> Sent: Sunday, August 17, 2014 5:40 PM >> To

Re: [PATCH] infiniband: hw: cxgb3: cxio_hal.c: Cleaning up missing null-terminate after strncpy call

2014-08-18 Thread Rickard Strandqvist
2014-08-18 16:27 GMT+02:00 Steve Wise sw...@opengridcomputing.com: -Original Message- From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel-ow...@vger.kernel.org] On Behalf Of Rickard Strandqvist Sent: Sunday, August 17, 2014 5:40 PM To: Steve Wise; Roland Dreier Cc

[PATCH] infiniband: hw: cxgb3: cxio_hal.c: Cleaning up missing null-terminate after strncpy call

2014-08-17 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/infiniband/hw/cxgb3/cxio_hal.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c index de1c61b4..5fc04e4

[PATCH] infiniband: hw: cxgb3: cxio_hal.c: Cleaning up missing null-terminate after strncpy call

2014-08-17 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/infiniband/hw/cxgb3/cxio_hal.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw

Re: [PATCH v4] i2c: busses: i2c-pxa.c: Fix for possible null pointer dereference

2014-08-16 Thread Rickard Strandqvist
, i2c); >> -ereqirq: >> - clk_disable_unprepare(i2c->clk); >> - iounmap(i2c->reg_base); >> -eremap: >> - clk_put(i2c->clk); >> -eclk: >> - kfree(i2c); >> -emalloc: >> - release_mem_region(res->start, resource

Re: [PATCH V2] net: ethernet: myricom: myri10ge: myri10ge.c: Cleaning up missing null-terminate after strncpy call

2014-08-16 Thread Rickard Strandqvist
2014-08-13 19:06 GMT+02:00 Jiri Pirko : > Mon, Aug 11, 2014 at 09:18:16PM CEST, rickard_strandqv...@spectrumdigital.se > wrote: >>Added a guaranteed null-terminate after call to strncpy. >> >>Signed-off-by: Rickard Strandqvist >>--- >> drivers/net/etherne

Re: [PATCH] staging: lustre: lustre: libcfs: workitem.c: Cleaning up missing null-terminate after strncpy call

2014-08-16 Thread Rickard Strandqvist
2014-08-12 16:58 GMT+02:00 Kees Cook : > On Sat, Aug 9, 2014 at 4:46 PM, Rickard Strandqvist > wrote: >> Added a guaranteed null-terminate after call to strncpy. >> >> Signed-off-by: Rickard Strandqvist >> --- >> drivers/staging/lustre/lustre/libcfs/worki

Re: [PATCH] staging: lustre: lustre: libcfs: workitem.c: Cleaning up missing null-terminate after strncpy call

2014-08-16 Thread Rickard Strandqvist
2014-08-12 16:58 GMT+02:00 Kees Cook keesc...@chromium.org: On Sat, Aug 9, 2014 at 4:46 PM, Rickard Strandqvist rickard_strandqv...@spectrumdigital.se wrote: Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se

Re: [PATCH V2] net: ethernet: myricom: myri10ge: myri10ge.c: Cleaning up missing null-terminate after strncpy call

2014-08-16 Thread Rickard Strandqvist
2014-08-13 19:06 GMT+02:00 Jiri Pirko j...@resnulli.us: Mon, Aug 11, 2014 at 09:18:16PM CEST, rickard_strandqv...@spectrumdigital.se wrote: Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net

Re: [PATCH v4] i2c: busses: i2c-pxa.c: Fix for possible null pointer dereference

2014-08-16 Thread Rickard Strandqvist
of hardware... Kind regards Rickard Strandqvist -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH v2] tile: avoid errors from truncating long strings in mpipe gxio

2014-08-11 Thread Rickard Strandqvist
rscpy(char *dest, const char *src, size_t size) >> +{ >> + size_t ret = strnlen(src, size) + 1; >> + if (ret > size) { >> + if (size) >> + dest[0] = '\0'; >> + return 0; >> + } >> + memcpy(dest,

Re: [PATCH] staging: lustre: lustre: ptlrpc: nrs.c: Cleaning up missing null-terminate after strncpy call

2014-08-11 Thread Rickard Strandqvist
2014-08-11 12:58 GMT+02:00 Dan Carpenter : > On Sun, Aug 10, 2014 at 01:49:12AM +0200, Rickard Strandqvist wrote: >> Added a guaranteed null-terminate after call to strncpy. > > No. This is a problem in the static checker and not in the code. > > Look at the start of the

[PATCH v2] misc: ti-st: st_kim.c: Cleaning up missing null-terminate after strncpy call

2014-08-11 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/misc/ti-st/st_kim.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 9d3dbb2..d050f53 100644 --- a/drivers/misc/ti-st

Re: [PATCH] misc: ti-st: st_kim.c: Cleaning up missing null-terminate after strncpy call

2014-08-11 Thread Rickard Strandqvist
1049168280159033135/posts/1amLbuhWbh5 I do this only when I'm sure it will not cause any other problems. But if you or anyone else can guarantee that in this case, so I'd make a new patch. Kind regards Rickard Strandqvist -- To unsubscribe from this list: send the line "unsubscribe linux-ke

[PATCH V2] net: ethernet: myricom: myri10ge: myri10ge.c: Cleaning up missing null-terminate after strncpy call

2014-08-11 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/net/ethernet/myricom/myri10ge/myri10ge.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge

[PATCH] net: wireless: ipw2x00: ipw2200.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-08-11 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist --- drivers/net/wireless/ipw2x00/ipw2200.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless

[PATCH] net: wireless: ipw2x00: ipw2200.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-08-11 Thread Rickard Strandqvist
Is there any reason that can not simply use the variable ssid directly in IPW_DEBUG_MERGE call instead of copying it to the escaped variable? Rickard Strandqvist (1): net: wireless: ipw2x00: ipw2200.c: Cleaning up missing null-terminate in conjunction with strncpy drivers/net/wireless

[PATCH] net: wireless: ipw2x00: ipw2200.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-08-11 Thread Rickard Strandqvist
Is there any reason that can not simply use the variable ssid directly in IPW_DEBUG_MERGE call instead of copying it to the escaped variable? Rickard Strandqvist (1): net: wireless: ipw2x00: ipw2200.c: Cleaning up missing null-terminate in conjunction with strncpy drivers/net/wireless

[PATCH] net: wireless: ipw2x00: ipw2200.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-08-11 Thread Rickard Strandqvist
Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/wireless/ipw2x00/ipw2200.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless

[PATCH V2] net: ethernet: myricom: myri10ge: myri10ge.c: Cleaning up missing null-terminate after strncpy call

2014-08-11 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/ethernet/myricom/myri10ge/myri10ge.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b

Re: [PATCH] misc: ti-st: st_kim.c: Cleaning up missing null-terminate after strncpy call

2014-08-11 Thread Rickard Strandqvist
when I'm sure it will not cause any other problems. But if you or anyone else can guarantee that in this case, so I'd make a new patch. Kind regards Rickard Strandqvist -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More

[PATCH v2] misc: ti-st: st_kim.c: Cleaning up missing null-terminate after strncpy call

2014-08-11 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/misc/ti-st/st_kim.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 9d3dbb2

Re: [PATCH] staging: lustre: lustre: ptlrpc: nrs.c: Cleaning up missing null-terminate after strncpy call

2014-08-11 Thread Rickard Strandqvist
2014-08-11 12:58 GMT+02:00 Dan Carpenter dan.carpen...@oracle.com: On Sun, Aug 10, 2014 at 01:49:12AM +0200, Rickard Strandqvist wrote: Added a guaranteed null-terminate after call to strncpy. No. This is a problem in the static checker and not in the code. Look at the start of the function

Re: [PATCH v2] tile: avoid errors from truncating long strings in mpipe gxio

2014-08-11 Thread Rickard Strandqvist
); + return ret; +} -- ~Randy Hi Sounds like a great idea! Do it Chris! Randy? Kind regards Rickard Strandqvist -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo

[PATCH] staging: lustre: lustre: ptlrpc: nrs.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/staging/lustre/lustre/ptlrpc/nrs.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index

[PATCH] staging: lustre: lustre: obdclass: genops.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/staging/lustre/lustre/obdclass/genops.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass

[PATCH] staging: lustre: lustre: libcfs: workitem.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/staging/lustre/lustre/libcfs/workitem.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs

[PATCH] misc: ti-st: st_kim.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/misc/ti-st/st_kim.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 9d3dbb2..bce4468 100644 --- a/drivers/misc/ti-st

[PATCH] misc: c2port: core.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/misc/c2port/core.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c index 464419b..62b0baa 100644 --- a/drivers/misc/c2port

[PATCH] message: fusion: mptbase.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/message/fusion/mptbase.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index ebc0af7..66324f8

[PATCH] net: ethernet: ti: cpmac.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/net/ethernet/ti/cpmac.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c index 7399a52..ad268a3 100644 --- a/drivers

[PATCH] net: ethernet: myricom: myri10ge: myri10ge.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/net/ethernet/myricom/myri10ge/myri10ge.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge

[PATCH] net: wireless: ipw2x00: ipw2200.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist --- drivers/net/wireless/ipw2x00/ipw2200.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index c5aa404..389656b

[PATCH] net: wireless: ipw2x00: ipw2200.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/wireless/ipw2x00/ipw2200.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless

[PATCH] net: ethernet: myricom: myri10ge: myri10ge.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/ethernet/myricom/myri10ge/myri10ge.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b

[PATCH] net: ethernet: ti: cpmac.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/ethernet/ti/cpmac.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c index

[PATCH] message: fusion: mptbase.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/message/fusion/mptbase.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message

[PATCH] misc: c2port: core.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/misc/c2port/core.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c index 464419b..62b0baa

[PATCH] misc: ti-st: st_kim.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/misc/ti-st/st_kim.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 9d3dbb2

[PATCH] staging: lustre: lustre: libcfs: workitem.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/staging/lustre/lustre/libcfs/workitem.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers

[PATCH] staging: lustre: lustre: obdclass: genops.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/staging/lustre/lustre/obdclass/genops.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers

[PATCH] staging: lustre: lustre: ptlrpc: nrs.c: Cleaning up missing null-terminate after strncpy call

2014-08-09 Thread Rickard Strandqvist
Added a guaranteed null-terminate after call to strncpy. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/staging/lustre/lustre/ptlrpc/nrs.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging

Re: [PATCH v2] tile: avoid errors from truncating long strings in mpipe gxio

2014-08-06 Thread Rickard Strandqvist
pe_link_name_t name; > int rv; > > - strncpy(name.name, link_name, sizeof(name.name)); > - name.name[GXIO_MPIPE_LINK_NAME_LEN - 1] = '\0'; > + if (strscpy(name.name, link_name, sizeof(name.name)) == 0) > + return GXIO_ERR_NO_DEVICE; > >

Re: [PATCH v2] tile: avoid errors from truncating long strings in mpipe gxio

2014-08-06 Thread Rickard Strandqvist
GXIO_ERR_NO_DEVICE; rv = gxio_mpipe_link_open_aux(context, name, flags); if (rv 0) -- 1.8.3.1 Looks good to me, and I did some tests to of the strncpy funktion. Reviewed-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se Kind regards Rickard Strandqvist -- To unsubscribe from

Re: [PATCH] arch: tile: gxio: mpipe.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-08-05 Thread Rickard Strandqvist
2014-08-05 22:24 GMT+02:00 Chris Metcalf : > On 7/26/2014 10:03 AM, Rickard Strandqvist wrote: >> >> Replacing strncpy with strlcpy to avoid strings that lacks null terminate. >> >> Signed-off-by: Rickard Strandqvist >> >> --- > > > While using st

Re: [PATCH] arch: tile: kernel: setup.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-08-05 Thread Rickard Strandqvist
2014-08-05 22:12 GMT+02:00 Chris Metcalf : > On 7/26/2014 10:04 AM, Rickard Strandqvist wrote: >> >> Replacing strncpy with strlcpy to avoid strings that lacks null terminate. >> >> Signed-off-by: Rickard Strandqvist >> >> --- >> arch/tile/ke

Re: [PATCH] arch: tile: kernel: setup.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-08-05 Thread Rickard Strandqvist
2014-08-05 22:12 GMT+02:00 Chris Metcalf cmetc...@tilera.com: On 7/26/2014 10:04 AM, Rickard Strandqvist wrote: Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- arch/tile/kernel

Re: [PATCH] arch: tile: gxio: mpipe.c: Cleaning up missing null-terminate in conjunction with strncpy

2014-08-05 Thread Rickard Strandqvist
2014-08-05 22:24 GMT+02:00 Chris Metcalf cmetc...@tilera.com: On 7/26/2014 10:03 AM, Rickard Strandqvist wrote: Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- While using strlcpy

<    6   7   8   9   10   11   12   13   14   15   >