Date: Fri, 21 Feb 2020 22:44:23 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358233 - head/sys/cam/scsi Message-ID: <202002212244.01LMiN0t033793@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Fri Feb 21 22:44:22 2020 New Revision: 358233 URL: https://svnweb.freebsd.org/changeset/base/358233 Log: We pass a pointer to the flags to dabitsysctl, not an integer. Adjust the handler to accept a poitner to a u_int. To make the type of the softc flags stable and defined, make it a u_int. Cast the enum types to u_int for arg2 so when passing to dabitsysctl it's a u_int. Noticed by: emax@ Differential Revision: https://reviews.freebsd.org/D23785 Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Fri Feb 21 22:11:14 2020 (r358232) +++ head/sys/cam/scsi/scsi_da.c Fri Feb 21 22:44:22 2020 (r358233) @@ -342,7 +342,7 @@ struct da_softc { LIST_HEAD(, ccb_hdr) pending_ccbs; int refcount; /* Active xpt_action() calls */ da_state state; - da_flags flags; + u_int flags; da_quirks quirks; int minimum_cmd_size; int error_inject; @@ -2335,11 +2335,11 @@ dasysctlinit(void *context, int pending) "Flags for drive"); SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "rotating", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, - &softc->flags, DA_FLAG_ROTATING, dabitsysctl, "I", + &softc->flags, (u_int)DA_FLAG_ROTATING, dabitsysctl, "I", "Rotating media *DEPRECATED* gone in FreeBSD 14"); SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "unmapped_io", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, - &softc->flags, DA_FLAG_UNMAPPEDIO, dabitsysctl, "I", + &softc->flags, (u_int)DA_FLAG_UNMAPPEDIO, dabitsysctl, "I", "Unmapped I/O support *DEPRECATED* gone in FreeBSD 14"); #ifdef CAM_TEST_FAILURE @@ -2619,11 +2619,11 @@ dadeletemethodchoose(struct da_softc *softc, da_delete static int dabitsysctl(SYSCTL_HANDLER_ARGS) { - int flags = (intptr_t)arg1; - int test = arg2; + u_int *flags = arg1; + u_int test = arg2; int tmpout, error; - tmpout = !!(flags & test); + tmpout = !!(*flags & test); error = SYSCTL_OUT(req, &tmpout, sizeof(tmpout)); if (error || !req->newptr) return (error);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002212244.01LMiN0t033793>