lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20121011070203.GG31607@elgon.mountain>
Date:	Thu, 11 Oct 2012 10:02:03 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Krishna C Gudipati <kgudipat@...cade.com>
Cc:	"James E.J. Bottomley" <JBottomley@...allels.com>,
	linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: [patch] [SCSI] bfa: cleanup a memcpy()

Smatch complains that we are writing more data than ->srlid_base
member can hold.  In fact, we are over writing the whole struct.  I've
re-written it to be a bit more clear and to silence the static checker
warning.

Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>

diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c
index 0116c10..a6dc18e 100644
--- a/drivers/scsi/bfa/bfa_ioc.c
+++ b/drivers/scsi/bfa/bfa_ioc.c
@@ -3624,11 +3624,9 @@ bfa_sfp_show_comp(struct bfa_sfp_s *sfp, struct bfi_mbmsg_s *msg)
 	bfa_trc(sfp, sfp->memtype);
 	if (sfp->memtype == BFI_SFP_MEM_DIAGEXT) {
 		bfa_trc(sfp, sfp->data_valid);
-		if (sfp->data_valid) {
-			u32	size = sizeof(struct sfp_mem_s);
-			u8 *des = (u8 *) &(sfp->sfpmem->srlid_base);
-			memcpy(des, sfp->dbuf_kva, size);
-		}
+		if (sfp->data_valid)
+			memcpy(sfp->sfpmem, sfp->dbuf_kva,
+					sizeof(*sfp->sfpmem));
 		/*
 		 * Queue completion callback.
 		 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ