git: de992eed7818 - main - mpt: clear CCBs allocated on the stack

Edward Tomasz Napierala trasz at FreeBSD.org
Fri May 21 07:09:34 UTC 2021


The branch main has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=de992eed7818d49c027cdecabdfb8224a24bcac0

commit de992eed7818d49c027cdecabdfb8224a24bcac0
Author:     Edward Tomasz Napierala <trasz at FreeBSD.org>
AuthorDate: 2021-05-21 06:58:49 +0000
Commit:     Edward Tomasz Napierala <trasz at FreeBSD.org>
CommitDate: 2021-05-21 06:59:02 +0000

    mpt: clear CCBs allocated on the stack
    
    Reviewed By:    imp
    Sponsored by:   NetApp, Inc.
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D30302
---
 sys/dev/mpt/mpt_cam.c  | 1 +
 sys/dev/mpt/mpt_raid.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/sys/dev/mpt/mpt_cam.c b/sys/dev/mpt/mpt_cam.c
index 64776d673674..54bdc22759fa 100644
--- a/sys/dev/mpt/mpt_cam.c
+++ b/sys/dev/mpt/mpt_cam.c
@@ -2448,6 +2448,7 @@ mpt_cam_event(struct mpt_softc *mpt, request_t *req,
 				    "XPT_REL_SIMQ");
 				break;
 			}
+			memset(&crs, 0, sizeof(crs));
 			xpt_setup_ccb(&crs.ccb_h, tmppath, 5);
 			crs.ccb_h.func_code = XPT_REL_SIMQ;
 			crs.ccb_h.flags = CAM_DEV_QFREEZE;
diff --git a/sys/dev/mpt/mpt_raid.c b/sys/dev/mpt/mpt_raid.c
index 28667d85cf4d..603c2b42a370 100644
--- a/sys/dev/mpt/mpt_raid.c
+++ b/sys/dev/mpt/mpt_raid.c
@@ -296,6 +296,7 @@ mpt_raid_attach(struct mpt_softc *mpt)
 		goto cleanup;
 	}
 
+	memset(&csa, 0, sizeof(csa));
 	xpt_setup_ccb(&csa.ccb_h, mpt->path, 5);
 	csa.ccb_h.func_code = XPT_SASYNC_CB;
 	csa.event_enable = AC_FOUND_DEVICE;
@@ -336,6 +337,7 @@ mpt_raid_detach(struct mpt_softc *mpt)
 	handler.reply_handler = mpt_raid_reply_handler;
 	mpt_deregister_handler(mpt, MPT_HANDLER_REPLY, handler,
 			       raid_handler_id);
+	memset(&csa, 0, sizeof(csa));
 	xpt_setup_ccb(&csa.ccb_h, mpt->path, /*priority*/5);
 	csa.ccb_h.func_code = XPT_SASYNC_CB;
 	csa.event_enable = 0;
@@ -1071,6 +1073,7 @@ mpt_adjust_queue_depth(struct mpt_softc *mpt, struct mpt_raid_volume *mpt_vol,
 {
 	struct ccb_relsim crs;
 
+	memset(&crs, 0, sizeof(crs));
 	xpt_setup_ccb(&crs.ccb_h, path, /*priority*/5);
 	crs.ccb_h.func_code = XPT_REL_SIMQ;
 	crs.ccb_h.flags = CAM_DEV_QFREEZE;


More information about the dev-commits-src-all mailing list