xfs: avoid null *src in memcpy call in xlog_write
authorEric Sandeen <sandeen@redhat.com>
Mon, 12 Oct 2015 05:04:15 +0000 (16:04 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 12 Oct 2015 05:04:15 +0000 (16:04 +1100)
commit91f9f5fe1e7350e872b3fbc3194e8183bddce514
tree5aa10aef830c70180c090d43d4cf905baf5d2f54
parentdbd5c8c9a28899c6ca719eb21afc0afba9dd5574
xfs: avoid null *src in memcpy call in xlog_write

The gcc undefined behavior sanitizer caught this; surely
any sane memcpy implementation will no-op if size == 0,
but behavior with a *src of NULL is technically undefined
(declared nonnull), so avoid it here.

We are actually in this situation frequently via
xlog_commit_record(), because:

        struct xfs_log_iovec reg = {
                .i_addr = NULL,
                .i_len = 0,
                .i_type = XLOG_REG_TYPE_COMMIT,
        };

Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_log.c