Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Dec 2019 13:56:49 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r356225 - head/sys/dev/atkbdc
Message-ID:  <201912311356.xBVDun45066279@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Tue Dec 31 13:56:48 2019
New Revision: 356225
URL: https://svnweb.freebsd.org/changeset/base/356225

Log:
  psm: properly check for atkbdc_open failure
  
  atkbdc_open can return NULL if the unit's out of bounds or the softc isn't
  setup. Check it to be safe.

Modified:
  head/sys/dev/atkbdc/psm.c

Modified: head/sys/dev/atkbdc/psm.c
==============================================================================
--- head/sys/dev/atkbdc/psm.c	Tue Dec 31 12:29:01 2019	(r356224)
+++ head/sys/dev/atkbdc/psm.c	Tue Dec 31 13:56:48 2019	(r356225)
@@ -1390,6 +1390,8 @@ psmprobe(device_t dev)
 
 	sc->unit = unit;
 	sc->kbdc = atkbdc_open(device_get_unit(device_get_parent(dev)));
+	if (sc->kbdc == NULL)
+		return (ENXIO);
 	sc->config = device_get_flags(dev) & PSM_CONFIG_FLAGS;
 	/* XXX: for backward compatibility */
 #if defined(PSM_HOOKRESUME) || defined(PSM_HOOKAPM)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912311356.xBVDun45066279>