Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Apr 2019 07:09:29 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345839 - head/sbin/fsck_msdosfs
Message-ID:  <201904030709.x3379T7E038959@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Wed Apr  3 07:09:28 2019
New Revision: 345839
URL: https://svnweb.freebsd.org/changeset/base/345839

Log:
  Assert that q can't be NULL.  'empty' is always non-NULL when DIREMPTY
  is set earlier.
  
  MFC after:	1 month

Modified:
  head/sbin/fsck_msdosfs/dir.c

Modified: head/sbin/fsck_msdosfs/dir.c
==============================================================================
--- head/sbin/fsck_msdosfs/dir.c	Wed Apr  3 06:37:25 2019	(r345838)
+++ head/sbin/fsck_msdosfs/dir.c	Wed Apr  3 07:09:28 2019	(r345839)
@@ -35,6 +35,7 @@ static const char rcsid[] =
   "$FreeBSD$";
 #endif /* not lint */
 
+#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -520,7 +521,8 @@ readDosDirSection(int f, struct bootblock *boot, struc
 							   empcl, empty - buffer,
 							   cl, p - buffer, 1) == FSFATAL)
 							return FSFATAL;
-						q = empcl == cl ? empty : buffer;
+						q = ((empcl == cl) ? empty : buffer);
+						assert(q != NULL);
 						for (; q < p; q += 32)
 							*q = SLOT_DELETED;
 						mod |= THISMOD|FSDIRMOD;



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