diff options
author | Jakob Normark <jakobnormark@gmail.com> | 2013-05-15 15:41:51 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-06-26 10:59:37 -0400 |
commit | c6e23d83c35380909edf2eb364943719bc10e9be (patch) | |
tree | d0e0c0ea6a21646648b46802ddedaab25f5106f6 /drivers/scsi/bfa | |
parent | 7525be545c839a65bb05ac71e795d17eafcaf20a (diff) |
[SCSI] bfa: Fixes for 0-terminated strncpy and possible null pointer dereference
This patch fixes two cppcheck errors in drivers/scsi/bfa/bfad_im.c
[jejb: correct strlcpy fix]
Signed-off-by: Jakob Normark <jakobnormark@gmail.com>
Acked-by: Vijay Mohan Guvva <vmohan@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r-- | drivers/scsi/bfa/bfad_im.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 5864f987f206..9796284512a9 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c | |||
@@ -944,13 +944,15 @@ static int | |||
944 | bfad_im_slave_alloc(struct scsi_device *sdev) | 944 | bfad_im_slave_alloc(struct scsi_device *sdev) |
945 | { | 945 | { |
946 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); | 946 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); |
947 | struct bfad_itnim_data_s *itnim_data = | 947 | struct bfad_itnim_data_s *itnim_data; |
948 | (struct bfad_itnim_data_s *) rport->dd_data; | 948 | struct bfa_s *bfa; |
949 | struct bfa_s *bfa = itnim_data->itnim->bfa_itnim->bfa; | ||
950 | 949 | ||
951 | if (!rport || fc_remote_port_chkready(rport)) | 950 | if (!rport || fc_remote_port_chkready(rport)) |
952 | return -ENXIO; | 951 | return -ENXIO; |
953 | 952 | ||
953 | itnim_data = (struct bfad_itnim_data_s *) rport->dd_data; | ||
954 | bfa = itnim_data->itnim->bfa_itnim->bfa; | ||
955 | |||
954 | if (bfa_get_lun_mask_status(bfa) == BFA_LUNMASK_ENABLED) { | 956 | if (bfa_get_lun_mask_status(bfa) == BFA_LUNMASK_ENABLED) { |
955 | /* | 957 | /* |
956 | * We should not mask LUN 0 - since this will translate | 958 | * We should not mask LUN 0 - since this will translate |
@@ -1035,7 +1037,7 @@ bfad_fc_host_init(struct bfad_im_port_s *im_port) | |||
1035 | /* For fibre channel services type 0x20 */ | 1037 | /* For fibre channel services type 0x20 */ |
1036 | fc_host_supported_fc4s(host)[7] = 1; | 1038 | fc_host_supported_fc4s(host)[7] = 1; |
1037 | 1039 | ||
1038 | strncpy(symname, bfad->bfa_fcs.fabric.bport.port_cfg.sym_name.symname, | 1040 | strlcpy(symname, bfad->bfa_fcs.fabric.bport.port_cfg.sym_name.symname, |
1039 | BFA_SYMNAME_MAXLEN); | 1041 | BFA_SYMNAME_MAXLEN); |
1040 | sprintf(fc_host_symbolic_name(host), "%s", symname); | 1042 | sprintf(fc_host_symbolic_name(host), "%s", symname); |
1041 | 1043 | ||