xfs-masters
[Top] [All Lists]

[PATCH] xfs: Use memset to initialize structure member.

To: bpm@xxxxxxx
Subject: [PATCH] xfs: Use memset to initialize structure member.
From: santosh nayak <santoshprasadnayak@xxxxxxxxx>
Date: Fri, 24 Feb 2012 12:38:42 +0530
Cc: elder@xxxxxxxxxx, xfs-masters@xxxxxxxxxxx, xfs@xxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, kernel-janitors@xxxxxxxxxxxxxxx, Santosh Nayak <santoshprasadnayak@xxxxxxxxx>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=STCnZMWzzg+55qAScYozfNOy/KtES1o2esOPsA0Zj4E=; b=aB7d569IRsKHu/Zz9KAQBXXTkqJl/9raKq+glRn9DTXxwOqAodZ3aviR5P1A+DnRR1 JQ3q5SodrlqD601csLdOiT32BuRI78OY4sbgmD6YW0I897b9xENSrK8KjQ7HHC1nmGQu cs6SCw6zSGZOvLY9pZGVbdDQLGjN2R5Y9fEmk=
From: Santosh Nayak <santoshprasadnayak@xxxxxxxxx>

Sparse is giving following warning:
fs/xfs/xfs_bmap.c:4826:41: warning: Using plain integer as NULL pointer.

To avoid this warning, use memset to initialize the structure member.

Signed-off-by: Santosh Nayak <santoshprasadnayak@xxxxxxxxx>
---
 fs/xfs/xfs_bmap.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 188ef2f..030e93f 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -4823,7 +4823,7 @@ xfs_bmapi_write(
 {
        struct xfs_mount        *mp = ip->i_mount;
        struct xfs_ifork        *ifp;
-       struct xfs_bmalloca     bma = { 0 };    /* args for xfs_bmap_alloc */
+       struct xfs_bmalloca     bma;            /* args for xfs_bmap_alloc */
        xfs_fileoff_t           end;            /* end of mapped file region */
        int                     eof;            /* after the end of extents */
        int                     error;          /* error return */
@@ -4852,6 +4852,8 @@ xfs_bmapi_write(
        ASSERT(!(flags & XFS_BMAPI_IGSTATE));
        ASSERT(tp != NULL);
        ASSERT(len > 0);
+
+       memset(&bma, 0, sizeof(bma));
 
        whichfork = (flags & XFS_BMAPI_ATTRFORK) ?
                XFS_ATTR_FORK : XFS_DATA_FORK;
-- 
1.7.4.4

<Prev in Thread] Current Thread [Next in Thread>