]> git.karo-electronics.de Git - linux-beck.git/commitdiff
xfs: fix possible NULL dereference in xlog_verify_iclog
authorGeyslan G. Bem <geyslan@gmail.com>
Wed, 30 Oct 2013 21:01:00 +0000 (16:01 -0500)
committerBen Myers <bpm@sgi.com>
Wed, 30 Oct 2013 21:01:00 +0000 (16:01 -0500)
In xlog_verify_iclog a debug check of the incore log buffers prints an
error if icptr is null and then goes on to dereference the pointer
regardless.  Convert this to an assert so that the intention is clear.
This was reported by Coverty.

Signed-off-by: Ben Myers <bpm@sgi.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
fs/xfs/xfs_log.c

index e523396753c5068cebe7ee8dd3b889623bf1c8f0..49dd41e6a2dcb4fe15e022b48d73456627c81e21 100644 (file)
@@ -3710,11 +3710,9 @@ xlog_verify_iclog(
        /* check validity of iclog pointers */
        spin_lock(&log->l_icloglock);
        icptr = log->l_iclog;
-       for (i=0; i < log->l_iclog_bufs; i++) {
-               if (icptr == NULL)
-                       xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
-               icptr = icptr->ic_next;
-       }
+       for (i = 0; i < log->l_iclog_bufs; i++, icptr = icptr->ic_next)
+               ASSERT(icptr);
+
        if (icptr != log->l_iclog)
                xfs_emerg(log->l_mp, "%s: corrupt iclog ring", __func__);
        spin_unlock(&log->l_icloglock);