From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25689C433E1 for ; Wed, 26 Aug 2020 22:00:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 089B0207CD for ; Wed, 26 Aug 2020 22:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726803AbgHZV77 (ORCPT ); Wed, 26 Aug 2020 17:59:59 -0400 Received: from mail106.syd.optusnet.com.au ([211.29.132.42]:38146 "EHLO mail106.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726753AbgHZV77 (ORCPT ); Wed, 26 Aug 2020 17:59:59 -0400 Received: from dread.disaster.area (pa49-181-146-199.pa.nsw.optusnet.com.au [49.181.146.199]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 367F56AC603; Thu, 27 Aug 2020 07:59:55 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1kB3SU-0003pv-35; Thu, 27 Aug 2020 07:59:54 +1000 Date: Thu, 27 Aug 2020 07:59:54 +1000 From: Dave Chinner To: "Darrick J. Wong" Cc: linux-xfs@vger.kernel.org, Eric Sandeen Subject: Re: [PATCH v2] xfs: initialize the shortform attr header padding entry Message-ID: <20200826215954.GV12131@dread.disaster.area> References: <20200826153912.GN6096@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200826153912.GN6096@magnolia> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=XJ9OtjpE c=1 sm=1 tr=0 cx=a_idp_d a=GorAHYkI+xOargNMzM6qxQ==:117 a=GorAHYkI+xOargNMzM6qxQ==:17 a=kj9zAlcOel0A:10 a=y4yBn9ojGxQA:10 a=yPCof4ZbAAAA:8 a=20KFwNOVAAAA:8 a=7-415B0cAAAA:8 a=2Lcqb-XjULW5F1MUNaYA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Wed, Aug 26, 2020 at 08:39:22AM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong > > Don't leak kernel memory contents into the shortform attr fork. > > Signed-off-by: Darrick J. Wong > --- > v2: memset instead of setting padding by hand > --- > fs/xfs/libxfs/xfs_attr_leaf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c > index 8623c815164a..e730586bff85 100644 > --- a/fs/xfs/libxfs/xfs_attr_leaf.c > +++ b/fs/xfs/libxfs/xfs_attr_leaf.c > @@ -653,8 +653,8 @@ xfs_attr_shortform_create( > ASSERT(ifp->if_flags & XFS_IFINLINE); > } > xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK); > - hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data; > - hdr->count = 0; > + hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data; > + memset(hdr, 0, sizeof(*hdr)); > hdr->totsize = cpu_to_be16(sizeof(*hdr)); > xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); > } Looks good. Reviewed-by: Dave Chinner -- Dave Chinner david@fromorbit.com