Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
Signed-off-by: Rickard Strandqvist
---
block/bsg.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/bsg.c b/block/bsg.c
index ff46add..b2688c5 100644
--- a/block/bsg.c
+++ b/block/bsg.c
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfad_attr.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index 40be670
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/ibmvscsi/ibmvscsi.c |7 +++
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/qla4xxx/ql4_os.c | 14 +++---
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfad_bsg.c |4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index 8994fb8
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
And removed unnecessary magic numbers.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/mpt2sas/mpt2sas_base.c | 31 +++
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
And removed unnecessary magic numbers.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/mpt3sas/mpt3sas_base.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c
If you are going to use memset before strncpy you must copy sizeof -1
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/scsi_tgt_if.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_tgt_if.c b/drivers/scsi/scsi_tgt_if.c
index 6209110..7dc98eb 100644
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
And in some cases modified to copy one character less than the overall
length, as the entire area is already zeroed.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/qla4xxx/ql4_mbx.c | 14 +++---
1 file
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
And use the sizeof on the to string rather than strlen on the from string.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/3w-9xxx.c |3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
And use the sizeof on the to string rather than strlen on the from string.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfa_fcbuild.c |8
1 file changed, 4 insertions(+), 4 deletions(-)
diff
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
In some cases modified to copy one character less than the overall
length, as the entire area is already zeroed. And replacing strncat
with strlcat because of incorrect use.
Signed-off-by: Rickard Strandqvist
---
drivers
Replacing strncp with strlcpy to avoid strings that lacks null terminate.
And strncat with strlcat because of incorrect use,
removed same the duplicated code.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfa_fcs.c | 80 ++--
1 file changed
2014-07-28 16:31 GMT+02:00 Jeff Moyer :
> Rickard Strandqvist writes:
>
>> Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
>>
>> Signed-off-by: Rickard Strandqvist
>> ---
>> block/bsg.c |2 +-
>> 1 file changed, 1 inse
If you are going to use memset before strncpy you must copy sizeof -1.
And removed unnecessary magic numbers.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/ch.c | 12
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index
If you use kzalloc before strncpy you must copy sizeof -1.
And removed unnecessary magic numbers.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/csiostor/csio_init.c |3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/csiostor/csio_init.c
b/drivers/scsi
Code clarification using strlcpy instead of strncpy.
And removed unnecessary memset
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/hpsa.c | 16 +++-
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 31184b3..814d64d
And as I understand it, it is fine to replace strncpy to strlcpy here.
But if any of this code do not want a null terminated, or want to have the
whole rest of size filled with null characters.
If that is the case this is not a good patch.
Rickard Strandqvist (1):
scsi: ibmvscsi: ibmvfc.c
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/ibmvscsi/ibmvfc.c | 10 ++
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/ibmvscsi/ibmvstgt.c |4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index
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
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
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
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
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
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 "fr
There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/message/fusion/mptscsih.c |4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a
There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfa_fcs_lport.c |3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers
There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bnx2i/bnx2i_iscsi.c |5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a
There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/dc395x.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/dc395x.c
There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/mpt2sas/mpt2sas_base.c |4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a
There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/mvsas/mv_sas.c | 24 ++--
1 file changed, 14 insertions(+), 10 deletions
There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/pm8001/pm8001_hwi.c |3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers
Okay, good!
Or, do I need to do anything else :-)
Best regards
Rickard Strandqvist
2014-05-19 13:39 GMT+02:00 Oliver Neukum :
> On Sun, 2014-05-18 at 21:50 +0200, Guennadi Liakhovetski wrote:
>> On Sun, 18 May 2014, Rickard Strandqvist wrote:
>>
>> > There is otherwise a
Hi
Quite rightly, this is what cppcheck reacts.
Ok, I'll send a patch for that instead then.
Best regards
Rickard Strandqvist
2014-05-28 13:38 GMT+02:00 Tomas Henzl :
> On 05/28/2014 01:28 PM, Christoph Hellwig wrote:
>> On Sun, May 18, 2014 at 06:14:00PM +0200, Rickard Str
Removal of null pointer checks that could never happen
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/pm8001/pm8001_hwi.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index a97be01..721d059 100644
There is a risk that the variable will be used without being initialized.
This was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/advansys.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a
There is a risk that the variable will be used without being initialized.
This was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/mpt3sas/mpt3sas_transport.c |6 ++
1 file changed, 2 insertions(+), 4 deletions
There is a risk that the variable will be used without being initialized.
This was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/pm8001/pm80xx_hwi.c |6 ++
1 file changed, 2 insertions(+), 4 deletions(-)
diff
There is a risk that the variable will be used without being initialized.
This was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/sun3_NCR5380.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a
Minimized the use of snprintf()
And removed a variable that was only used for the temporary storage.
This was partly found using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfad_attr.c | 14 --
1 file changed, 8
Added a guaranteed null-terminate after call to strncpy.
This was partly found using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfad_attr.c |3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/bfa
Added a guaranteed null-terminate after call to strncpy.
This was partly found using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/ibmvscsi/ibmvscsi.c |4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi
Added a guaranteed null-terminate after call to strncpy.
This was partly found using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/mpt2sas/mpt2sas_base.c |3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi
Added a guaranteed null-terminate after call to strncpy.
This was partly found using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/mpt3sas/mpt3sas_base.c |3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi
Hi
A little embarrassing, but I actually did not know that there was a
better replacement for strncpy.
Sorry, but I will send a new platch based on strlcpy instead then.
Will investigate cover letter then to.
Best regards
Rickard Strandqvist
2014-06-05 0:01 GMT+02:00 Joe Perches :
> On
whole
incoming struct.
But the only thing that is done then is a:
strncpy(port_attr->port_sym_name.symname,
(char *)&bfa_fcs_lport_get_psym_name(port), BFA_SYMNAME_MAXLEN);
Thus not having BFA_SYMNAME_MAXLEN -1 that would be a solution.
Best regards
Rickard Strandqvist
201
switch to strcpy outright.
So what happens now?
Should I make a new patch, with strlcpy or just straight off with strcpy then?
Best regards
Rickard Strandqvist
2014-06-05 0:28 GMT+02:00 James Bottomley
:
> On Wed, 2014-06-04 at 23:36 +0200, Rickard Strandqvist wrote:
>> Added a guaran
Minimized the use of snprintf()
And removed a variable that was only used for the temporary storage.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfad_attr.c | 114 --
1 file changed, 66 insertions(+), 48 deletions(-)
diff --git a/drivers
snprintf to strlcpy.
Best regards
Rickard Strandqvist
2014-06-05 9:10 GMT+02:00 Bart Van Assche :
> On 06/05/14 08:55, Bart Van Assche wrote:
>> On 06/04/14 20:08, Rickard Strandqvist wrote:
>> This is ugly. Please use sprintf(buf, "%.*s\n", PAGE_SIZE - 1, str)
>>
A variable to manage the error code is not returned.
This was partly found using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/mpt2sas/mpt2sas_base.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi
A variable to manage the error code is not returned.
This was partly found using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/mpt3sas/mpt3sas_base.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi
A struct member variable is set to the same value more than once
This was found using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/advansys.c |2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/scsi/advansys.c b/drivers/scsi
A struct member variable is set to different values without having used in
between.
This was found using a static code analysis program called cppcheck
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/pm8001/pm80xx_hwi.c |1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/scsi
A struct member variable is set to different values without having used in
between.
This was found using a static code analysis program called cppcheck
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bnx2i/bnx2i_iscsi.c |1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/scsi
2014-06-25 19:13 GMT+02:00 Eddie Wai :
> On Wed, 2014-06-25 at 16:26 +0200, Maurizio Lombardi wrote:
>> Hi,
>>
>> On 06/25/2014 04:04 PM, Rickard Strandqvist wrote:
>> > A struct member variable is set to different values without having used in
>> > be
A struct member variable is set to different values without having used in
between.
This was found using a static code analysis program called cppcheck
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bnx2i/bnx2i_iscsi.c |3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff
After some discussion, all agreed that the previous value was incorrect.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bnx2i/bnx2i_iscsi.c |3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index
#x27;ve done quite a few more patches that
there should not have been any {}
And then, it is perhaps good to sett a start value for ioc_status. My
suggestion is:
u16 ioc_status = MPI2_IOCSTATUS_OP_STATE_NOT_SUPPORTED;
Kind regards
Rickard Strandqvist
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Changed same snprintf and sprintf to strlcpy and strlcat.
This will guarantee that the string size is not overwritten,
and they are significantly faster than sprintf also.
Signed-off-by: Rickard Strandqvist
---
drivers/target/iscsi/iscsi_target_tpg.c | 16 +++-
1 file changed, 7
2014-10-12 20:18 GMT+02:00 Joe Perches :
> On Sun, 2014-10-12 at 19:55 +0200, Rickard Strandqvist wrote:
>> Changed same snprintf and sprintf to strlcpy and strlcat.
>> This will guarantee that the string size is not overwritten,
>> and they are significantly faster than spri
Ensures that the string is null-terminate in connection with the
use of strncpy, by switching from strncpy to strzcpy.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfa_fcs_lport.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c
2014-10-20 17:37 GMT+02:00 Dan Carpenter :
> On Sun, Oct 19, 2014 at 12:13:10AM +0200, Rickard Strandqvist wrote:
>> Ensures that the string is null-terminate in connection with the
>> use of strncpy, by switching from strncpy to strzcpy.
>>
>
> I wish the changelogs w
Remove the function bfa_tskim_iodone() that is not used anywhere.
This was partially found by using a static code analysis program called
cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfa_fcpim.c |9 -
drivers/scsi/bfa/bfa_fcpim.h |1 -
2 files changed, 10
() fc_rrq_rsp_parse()
This was partially found by using a static code analysis program called
cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfa_fcbuild.c | 607
drivers/scsi/bfa/bfa_fcbuild.h | 87 --
2 files changed, 694 deletions
Remove the function bfad_drv_uninit() that is not used anywhere.
This was partially found by using a static code analysis program called
cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/bfa/bfad.c | 20
drivers/scsi/bfa/bfad_drv.h |1 -
2 files
Remove the function cumanascsi_setup() that is not used anywhere.
This was partially found by using a static code analysis program called
cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/arm/cumana_1.c |4
1 file changed, 4 deletions(-)
diff --git a/drivers/scsi/arm
2014-12-20 17:50 GMT+01:00 Jeremiah Mahler :
> On Sat, Dec 20, 2014 at 05:36:15PM +0100, Rickard Strandqvist wrote:
>> Remove the function cumanascsi_setup() that is not used anywhere.
>>
>> This was partially found by using a static code analysis program called
>> cp
Remove the function gdth_ioctl_check_bin() that is not used anywhere.
This was partially found by using a static code analysis program called
cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/gdth_proc.c | 18 --
1 file changed, 18 deletions(-)
diff --git a
2014-08-01 0:19 GMT+02:00 adam radford :
> On Sun, Jul 27, 2014 at 8:11 AM, Rickard Strandqvist
> wrote:
>> Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
>> And use the sizeof on the to string rather than strlen on the from string.
>>
&
Removes some functions that are not used anywhere:
csk_print_ip() csk_print_port()
This was partially found by using a static code analysis program called
cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/cxgbi/libcxgbi.c | 28
1 file changed, 28
Remove the function aic7770_find_device() that is not used anywhere.
This was partially found by using a static code analysis program called
cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/aic7xxx/aic7770.c | 14 --
drivers/scsi/aic7xxx/aic7xxx.h |1 -
2 files
Removes some functions that are not used anywhere:
ahc_outq() ahc_inq()
This was partially found by using a static code analysis program called
cppcheck.
Signed-off-by: Rickard Strandqvist
---
drivers/scsi/aic7xxx/aic7xxx_core.c | 26 --
drivers/scsi/aic7xxx
73 matches
Mail list logo