From patchwork Wed Nov 8 12:38:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: zangyangyang1 X-Patchwork-Id: 13449869 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB757C4332F for ; Wed, 8 Nov 2023 12:55:32 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1r0i5i-0001Om-Lk; Wed, 08 Nov 2023 12:55:30 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r0i5b-0001Oe-3N for linux-f2fs-devel@lists.sourceforge.net; Wed, 08 Nov 2023 12:55:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Date:Subject:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=++Fww7jPXa+C1eqV07jg0855mD6W9R2cWUeJm05yG9Q=; b=IBplqMPhn4WYWTRxXO1+nBV/6z g4lYB877eMpjl95ahsxIVkB11GTGmCxVdjqZR4Tvs+2ESrUYltMqsGLUVfaVDck9ypz0h8WiSUXlh e+revsJQo9LjNfpNspKpsbBJ5UpIiXpdvvvp7i8aAG1d7uUzaxlG7NKirZ+VBH2jdBEA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:CC:To:From:Sender:Reply-To:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=++Fww7jPXa+C1eqV07jg0855mD6W9R2cWUeJm05yG9Q=; b=l NlsF/RdtuWL9CPdO06HNZ8FbPmhjBzzWJ7Fx6t5I4SM4G/2HAf7Atgiu7gSK5bz8HDiyevOmGJVBk AQ5IwQ8u7g6H3/vfQLE/7HffxfALgqYWzWsIcCgfw7TO/BVhnny6vI/S9uG6xznpf1htemLqr66SC h+zWrTrEAdwy/Fwc=; Received: from outboundhk.mxmail.xiaomi.com ([207.226.244.122]) by sfi-mx-1.v28.lw.sourceforge.com with esmtp (Exim 4.95) id 1r0i5Y-00Fn1v-PP for linux-f2fs-devel@lists.sourceforge.net; Wed, 08 Nov 2023 12:55:23 +0000 X-IronPort-AV: E=Sophos;i="6.03,286,1694707200"; d="scan'208";a="95805928" To: Date: Wed, 8 Nov 2023 20:38:30 +0800 Message-ID: <20231108123830.165855-1-zangyangyang1@xiaomi.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Originating-IP: [10.237.8.19] X-ClientProxiedBy: bj-mbx09.mioffice.cn (10.237.8.129) To BJ-MBX12.mioffice.cn (10.237.8.132) X-Headers-End: 1r0i5Y-00Fn1v-PP Subject: [f2fs-dev] [PATCH] libf2fs: Fix using uninitialized variables error in get_device_info() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: zangyangyang1 via Linux-f2fs-devel From: zangyangyang1 Reply-To: zangyangyang1 Cc: jaegeuk@kernel.org, zangyangyang1@xiaomi.com, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net This issue comes from a static code scanning tool. When c.sparse_mode is 1, stat_buf will not be initialized, but it will be used next. If this issue does not require modification, please ignore this commit. Signed-off-by: zangyangyang1 --- lib/libf2fs.c | 1 + 1 file changed, 1 insertion(+) -- 2.40.1 #/******±¾Óʼþ¼°Æ丽¼þº¬ÓÐСÃ×¹«Ë¾µÄ±£ÃÜÐÅÏ¢£¬½öÏÞÓÚ·¢Ë͸øÉÏÃæµØÖ·ÖÐÁгöµÄ¸öÈË»òȺ×é¡£½ûÖ¹ÈκÎÆäËûÈËÒÔÈκÎÐÎʽʹÓ㨰üÀ¨µ«²»ÏÞÓÚÈ«²¿»ò²¿·ÖµØй¶¡¢¸´ÖÆ¡¢»òÉ¢·¢£©±¾ÓʼþÖеÄÐÅÏ¢¡£Èç¹ûÄú´íÊÕÁ˱¾Óʼþ£¬ÇëÄúÁ¢¼´µç»°»òÓʼþ֪ͨ·¢¼þÈ˲¢É¾³ý±¾Óʼþ£¡ This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/# diff --git a/lib/libf2fs.c b/lib/libf2fs.c index 995e42d..0398c52 100644 --- a/lib/libf2fs.c +++ b/lib/libf2fs.c @@ -933,6 +933,7 @@ int get_device_info(int i) stat_buf = malloc(sizeof(struct stat)); ASSERT(stat_buf); + memset(stat_buf, 0, sizeof(struct stat)); if (!c.sparse_mode) { if (stat(dev->path, stat_buf) < 0 ) {