Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Mar 2016 00:31:06 +0000 (UTC)
From:      Steven Hartland <smh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r297125 - stable/10/sys/dev/mrsas
Message-ID:  <201603210031.u2L0V6VS039269@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: smh
Date: Mon Mar 21 00:31:06 2016
New Revision: 297125
URL: https://svnweb.freebsd.org/changeset/base/297125

Log:
  MFC r296020:
  
  Fix NULL pointer dereferences
  
  Sponsored by:	Multiplay

Modified:
  stable/10/sys/dev/mrsas/mrsas.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mrsas/mrsas.c
==============================================================================
--- stable/10/sys/dev/mrsas/mrsas.c	Mon Mar 21 00:29:45 2016	(r297124)
+++ stable/10/sys/dev/mrsas/mrsas.c	Mon Mar 21 00:31:06 2016	(r297125)
@@ -1272,14 +1272,12 @@ mrsas_get_softc_instance(struct cdev *de
 		 * Application
 		 */
 		sc = mrsas_mgmt_info.sc_ptr[user_ioc->host_no];
-		if ((user_ioc->host_no >= mrsas_mgmt_info.max_index) || (sc == NULL)) {
-			if (sc == NULL)
-				mrsas_dprint(sc, MRSAS_FAULT,
-				    "There is no Controller number %d .\n", user_ioc->host_no);
-			else
-				mrsas_dprint(sc, MRSAS_FAULT,
-				    "Invalid Controller number %d .\n", user_ioc->host_no);
-		}
+		if (sc == NULL)
+			printf("There is no Controller number %d\n",
+			    user_ioc->host_no);
+		else if (user_ioc->host_no >= mrsas_mgmt_info.max_index)
+			mrsas_dprint(sc, MRSAS_FAULT,
+			    "Invalid Controller number %d\n", user_ioc->host_no);
 	}
 
 	return sc;
@@ -4018,8 +4016,8 @@ mrsas_aen_handler(struct mrsas_softc *sc
 	u_int32_t seq_num;
 	int error;
 
-	if (!sc) {
-		device_printf(sc->mrsas_dev, "invalid instance!\n");
+	if (sc == NULL) {
+		printf("invalid instance!\n");
 		return;
 	}
 	if (sc->evt_detail_mem) {



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