Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2371156rdh; Tue, 26 Sep 2023 23:52:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGvL+oVzAbXBaV8mig4uDU+KMi089V/ihr3dRAY2viassJTha3vlF2XuSqxUhxweXVWN6q8 X-Received: by 2002:a05:6a00:2d28:b0:68e:2d9d:b0cc with SMTP id fa40-20020a056a002d2800b0068e2d9db0ccmr1504341pfb.6.1695797535982; Tue, 26 Sep 2023 23:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695797535; cv=none; d=google.com; s=arc-20160816; b=Rcdr3mp3gPP8zFFkoNBhHPPqyP8V0YhcKOLB9PLMRp1tVOTz1cE7UY2RVF7pqusSoX 9EUaF0w+FzDDYNFZ8y2vETPAPl8lITqsPweS0nTIfCW4sPdB/S11lBvkngDMcHgwfghl mO4zrXLDYkb0/RZ2/FKrL87oCGTACweve+5CB8e0ye8tUcj/WIr4RwEdGAYefg1gyEmG RSRA45BPWEDMwKmg2yM9T+KOotfjBLLapoF3v2spSUrJh99lKo/CpBKqGHRJW6CiKHK9 1FkNtad93zvvqLG2xTyOTY/0Z6E/TXCnjcOullOztjrWcCr5x84pKEMrIs7s0tA/W6Nm 9SVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=O0jAA+woumuLA9Y/Hhugz9kzwV8tjLOhFFhtPKqXptg=; fh=68jsZdHpMq/Vn0j5lYCXOpad+IXZIVvE4t93P9PflBM=; b=Xago41kxAMxkq0Nzf0EVMiU0rCg+BbyYP3AssCIR7GuowU74GEOsj2IT62xD2BNRXY O7yYp1iMlINSyPKDGNQ/F9g5utMj8/b0RrG5JmjXuCgB2cQmm495y/RQGzOwdZeTtAc/ bq30V7nkbK7mmowbTMZ0nE1153xNT6rgzwfugCIzWUXp0fdhnCpA2hM+y1ukXbRSqt3h 0R7aSjzYdcLKQ7i/7KFqch+8pBY+lfapMZFoaHaWpNE+jIOauZ0zDnkrxhEP1aWwc1RD GDVNHOaZAnk/1MLZqaFDTXPmbNSxHzsfVrEQqKUmj4DwAtJ2EhNqwT0LETWlJZXdn91m 6ccg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=G57yTHZf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i130-20020a639d88000000b0057754ded064si4058610pgd.555.2023.09.26.23.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 23:52:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=G57yTHZf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id DC53C801D4A5; Tue, 26 Sep 2023 23:45:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229555AbjI0Gpp (ORCPT + 99 others); Wed, 27 Sep 2023 02:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbjI0Gpn (ORCPT ); Wed, 27 Sep 2023 02:45:43 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F382D6; Tue, 26 Sep 2023 23:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695797142; x=1727333142; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=fjpZ8Wfu81snskyoNajzNhzf6MUHxeEtKQbFHYozL5s=; b=G57yTHZfEk4IfBym6OT6Uutt71q3DYYJN0HguEwT6XM9K6flHjEOePHW 2x76FOLhF2EEYXWscoTagFP0ShwL4/yZzS8FB2xee/zaDdkPxKtJECXxD MHLYxtecSAElmOeVOmcpXFjkAWsoFwtv4Ne477HRkM7Su10OChbGE2oTe IVosohBslsubyx9Zdnoxckh02wYCRwQFlRbFNxD2T4ASh5Uxlm7TkLf8A ttrksbT28X9sO6fA1PIrwon7sKnZ2uuocR1GxvJd5z5ZkS20uFE7EEVHG +v302JGazsqmSrNFwB5cFQ6egBLU278GmFYLS1DvXwDcnPOMw1wVbBIvt g==; X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="361130910" X-IronPort-AV: E=Sophos;i="6.03,179,1694761200"; d="scan'208";a="361130910" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 23:45:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="784212545" X-IronPort-AV: E=Sophos;i="6.03,179,1694761200"; d="scan'208";a="784212545" Received: from binbinwu-mobl.ccr.corp.intel.com (HELO binbinwu-mobl.sh.intel.com) ([10.238.8.84]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 23:45:38 -0700 From: Binbin Wu To: dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, weihong.zhang@intel.com, kirill.shutemov@linux.intel.com, binbin.wu@linux.intel.com Subject: [PATCH] selftests/x86/lam: Zero out buffer for readlink() Date: Sun, 24 Sep 2023 07:33:46 +0800 Message-Id: <20230923233346.12726-1-binbin.wu@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 26 Sep 2023 23:45:51 -0700 (PDT) Zero out the buffer for readlink() since readlink() does not append a terminating null byte to the buffer. Fixes: 833c12ce0f430 ("selftests/x86/lam: Add inherit test cases for linear-address masking") Signed-off-by: Binbin Wu --- tools/testing/selftests/x86/lam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/x86/lam.c b/tools/testing/selftests/x86/lam.c index eb0e46905bf9..9f06942a8e25 100644 --- a/tools/testing/selftests/x86/lam.c +++ b/tools/testing/selftests/x86/lam.c @@ -680,7 +680,7 @@ static int handle_execve(struct testcases *test) perror("Fork failed."); ret = 1; } else if (pid == 0) { - char path[PATH_MAX]; + char path[PATH_MAX] = {0}; /* Set LAM mode in parent process */ if (set_lam(lam) != 0) base-commit: ce9ecca0238b140b88f43859b211c9fdfd8e5b70 -- 2.25.1