svn commit: r296020 - head/sys/dev/mrsas

Steven Hartland smh at FreeBSD.org
Thu Feb 25 02:46:49 UTC 2016


Author: smh
Date: Thu Feb 25 02:46:47 2016
New Revision: 296020
URL: https://svnweb.freebsd.org/changeset/base/296020

Log:
  Fix NULL pointer dereferences
  
  Fix NULL pointer dereferences identified as V522 by PVS-Studio.
  
  MFC after:	1 week
  Sponsored by:	Multiplay

Modified:
  head/sys/dev/mrsas/mrsas.c

Modified: head/sys/dev/mrsas/mrsas.c
==============================================================================
--- head/sys/dev/mrsas/mrsas.c	Thu Feb 25 01:24:02 2016	(r296019)
+++ head/sys/dev/mrsas/mrsas.c	Thu Feb 25 02:46:47 2016	(r296020)
@@ -1274,14 +1274,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;
@@ -4023,8 +4021,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) {


More information about the svn-src-head mailing list