From: krw Date: Sat, 2 Apr 2022 17:25:10 +0000 (+0000) Subject: Add a paranoia/future proofing check for link->pool == NULL to X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=34ceb667563449b0c2871b87a9bb5cb5ae05fa82;p=openbsd Add a paranoia/future proofing check for link->pool == NULL to the SDEV_OWN_IOPL flag check. Ambiguous/inconsistant code pointed out by Coverity #1515557. --- diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index 78b2b4131c8..98a9b14d007 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.250 2022/04/02 13:57:39 krw Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.251 2022/04/02 17:25:10 krw Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -802,7 +802,7 @@ scsi_detach_link(struct scsi_link *link, int flags) } /* 3. If it's using the openings io allocator, clean that up. */ - if (ISSET(link->flags, SDEV_OWN_IOPL)) { + if (link->pool != NULL && ISSET(link->flags, SDEV_OWN_IOPL)) { scsi_iopool_destroy(link->pool); free(link->pool, M_DEVBUF, sizeof(*link->pool)); }