From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 824EB345CDC for ; Thu, 26 Feb 2026 11:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772104610; cv=none; b=eKZM13eLCb7WhXgSEnHZXBcEywQXeYCa8KAR0pAeXNdFGUUCrWK6XHjZTgQujQYCHj/DpNWOiuEvEmySXiTN9JzhRBu9bTpd+Hy+fuMD6TwMy0dsP63FnvzN4NlVJWPYFN9kOyWamXogyuZo42BCJtEhjUGsq/EKw30xulu1Ars= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772104610; c=relaxed/simple; bh=Yjnpmirda+LXwkMcUoPaIU9+H1+GJNwMZE6bnohy/rk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DEsgOy9eaDjYQ4DRBOGxf1YNGnDC6O0otZiJzAlXLwUmni8SnWMsTLYN3VlX81UDoBFz9P5eiOR0nXIQCUueirvLifbWepr5seWH9rjz3B5I8yzSFQXQyEmTO1CyBj2q7J6CFhaSudjk8isn3ZEz3WPKzC/SOMwaz4lz3JoqjiU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ggJmi3zq; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ggJmi3zq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772104608; x=1803640608; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Yjnpmirda+LXwkMcUoPaIU9+H1+GJNwMZE6bnohy/rk=; b=ggJmi3zqQYecBWToKE8gRVVRdVpUeDzkZtxgAiabYTjaFm2OCLPfAg/T pEXb/uaroaA9drr0z6bQrbMjhQwvcQJfEzoUGbL7Dr5UIY7mv0NMRkkpy ZK8u4/vEi9+E7wyKx2EIx14NXD4rxzSICFmYE7Kza4MLpWRO1WR3fzrqL B1tc6faGoRoVMyHSxnxZRD6zEA2rGd4HytTa292JVfCCrvJH0yrDe2Y1v gAhDRTD4EJZ/SMzdH9Hl+FkFdVsdJFIV/LclnAmp4JDZixVbB+twH4wc6 mGiXsU6Bj7YNt1CNrERfs18dcygsbJQrEb6LUykH96gsUXr6zaTlKerP+ A==; X-CSE-ConnectionGUID: zQpdAmgjQTu8gckQw47gow== X-CSE-MsgGUID: bUNwm1bGTe6+suuor5hT4Q== X-IronPort-AV: E=McAfee;i="6800,10657,11712"; a="73034141" X-IronPort-AV: E=Sophos;i="6.21,312,1763452800"; d="scan'208";a="73034141" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2026 03:16:48 -0800 X-CSE-ConnectionGUID: kUpjxBQIQrCHQDdLuCIDuA== X-CSE-MsgGUID: dlacpdb6RSqqYxPl303siQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,312,1763452800"; d="scan'208";a="254296559" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa001.jf.intel.com with ESMTP; 26 Feb 2026 03:16:47 -0800 Received: by black.igk.intel.com (Postfix, from userid 1003) id 37EF699; Thu, 26 Feb 2026 12:16:45 +0100 (CET) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Yury Norov , Rasmus Villemoes , Andrew Morton Subject: [PATCH v1 1/1] bitmap: Add test for out-of-boundary modifications for scatter & gather Date: Thu, 26 Feb 2026 12:16:44 +0100 Message-ID: <20260226111644.4177742-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Make sure that bitmap_scatter() and bitmap_gather() do not modify the bits outside of the given nbits span. Signed-off-by: Andy Shevchenko --- lib/test_bitmap.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index c83829ef557f..2952a6147e81 100644 --- a/lib/test_bitmap.c +++ b/lib/test_bitmap.c @@ -354,18 +354,22 @@ static void __init test_replace(void) static const unsigned long sg_mask[] __initconst = { BITMAP_FROM_U64(0x000000000000035aULL), + BITMAP_FROM_U64(0x0000000000000000ULL), }; static const unsigned long sg_src[] __initconst = { BITMAP_FROM_U64(0x0000000000000667ULL), + BITMAP_FROM_U64(0x0000000000000000ULL), }; static const unsigned long sg_gather_exp[] __initconst = { BITMAP_FROM_U64(0x0000000000000029ULL), + BITMAP_FROM_U64(0x0000000000000000ULL), }; static const unsigned long sg_scatter_exp[] __initconst = { BITMAP_FROM_U64(0x000000000000021aULL), + BITMAP_FROM_U64(0x0000000000000000ULL), }; static void __init test_bitmap_sg(void) @@ -379,18 +383,18 @@ static void __init test_bitmap_sg(void) /* Simple gather call */ bitmap_zero(bmap_gather, 100); bitmap_gather(bmap_gather, sg_src, sg_mask, nbits); - expect_eq_bitmap(sg_gather_exp, bmap_gather, nbits); + expect_eq_bitmap(sg_gather_exp, bmap_gather, 100); /* Simple scatter call */ bitmap_zero(bmap_scatter, 100); bitmap_scatter(bmap_scatter, sg_src, sg_mask, nbits); - expect_eq_bitmap(sg_scatter_exp, bmap_scatter, nbits); + expect_eq_bitmap(sg_scatter_exp, bmap_scatter, 100); /* Scatter/gather relationship */ bitmap_zero(bmap_tmp, 100); bitmap_gather(bmap_tmp, bmap_scatter, sg_mask, nbits); bitmap_scatter(bmap_res, bmap_tmp, sg_mask, nbits); - expect_eq_bitmap(bmap_scatter, bmap_res, nbits); + expect_eq_bitmap(bmap_scatter, bmap_res, 100); } #define PARSE_TIME 0x1 -- 2.50.1