From owner-svn-src-all@freebsd.org Thu May 16 04:24:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36D5615AC9F5; Thu, 16 May 2019 04:24:10 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF39488A95; Thu, 16 May 2019 04:24:09 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A133B1BC43; Thu, 16 May 2019 04:24:09 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4G4O9IM086585; Thu, 16 May 2019 04:24:09 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4G4O9LF086581; Thu, 16 May 2019 04:24:09 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201905160424.x4G4O9LF086581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Thu, 16 May 2019 04:24:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r347645 - head/sys/x86/iommu X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/x86/iommu X-SVN-Commit-Revision: 347645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CF39488A95 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 04:24:10 -0000 Author: rlibby Date: Thu May 16 04:24:08 2019 New Revision: 347645 URL: https://svnweb.freebsd.org/changeset/base/347645 Log: iommu static analysis cleanup A static analyzer complained about a couple instances of checking a variable against NULL after already having dereferenced it. - dmar_gas_alloc_region: remove the tautological NULL checks - dmar_release_resources / dmar_fini_fault_log: don't deref unit->regs unless initialized. And while here, fix an inverted initialization check in dmar_fini_qi. Reviewed by: kib Sponsored by: Dell EMC Isilon Differential revision: https://reviews.freebsd.org/D20263 Modified: head/sys/x86/iommu/intel_fault.c head/sys/x86/iommu/intel_gas.c head/sys/x86/iommu/intel_qi.c Modified: head/sys/x86/iommu/intel_fault.c ============================================================================== --- head/sys/x86/iommu/intel_fault.c Thu May 16 03:30:36 2019 (r347644) +++ head/sys/x86/iommu/intel_fault.c Thu May 16 04:24:08 2019 (r347645) @@ -291,12 +291,12 @@ void dmar_fini_fault_log(struct dmar_unit *unit) { + if (unit->fault_taskqueue == NULL) + return; + DMAR_LOCK(unit); dmar_disable_fault_intr(unit); DMAR_UNLOCK(unit); - - if (unit->fault_taskqueue == NULL) - return; taskqueue_drain(unit->fault_taskqueue, &unit->fault_task); taskqueue_free(unit->fault_taskqueue); Modified: head/sys/x86/iommu/intel_gas.c ============================================================================== --- head/sys/x86/iommu/intel_gas.c Thu May 16 03:30:36 2019 (r347644) +++ head/sys/x86/iommu/intel_gas.c Thu May 16 04:24:08 2019 (r347645) @@ -546,7 +546,7 @@ dmar_gas_alloc_region(struct dmar_domain *domain, stru return (EBUSY); entry->start = prev->end; } - if (next != NULL && next->start < entry->end && + if (next->start < entry->end && (next->flags & DMAR_MAP_ENTRY_PLACE) == 0) { if ((next->flags & DMAR_MAP_ENTRY_RMRR) == 0) return (EBUSY); @@ -560,7 +560,7 @@ dmar_gas_alloc_region(struct dmar_domain *domain, stru dmar_gas_rb_remove(domain, prev); prev = NULL; } - if (next != NULL && next->start < entry->end) { + if (next->start < entry->end) { dmar_gas_rb_remove(domain, next); next = NULL; } Modified: head/sys/x86/iommu/intel_qi.c ============================================================================== --- head/sys/x86/iommu/intel_qi.c Thu May 16 03:30:36 2019 (r347644) +++ head/sys/x86/iommu/intel_qi.c Thu May 16 04:24:08 2019 (r347645) @@ -425,7 +425,7 @@ dmar_fini_qi(struct dmar_unit *unit) { struct dmar_qi_genseq gseq; - if (unit->qi_enabled) + if (!unit->qi_enabled) return; taskqueue_drain(unit->qi_taskqueue, &unit->qi_task); taskqueue_free(unit->qi_taskqueue);