Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4014487ybl; Mon, 3 Feb 2020 10:52:35 -0800 (PST) X-Google-Smtp-Source: APXvYqxXVfN0nau/wR7g3ANPb78BiQcsSxYauuBS1hBNSjPcUfpaxmYjeK7feedqVz8TY+vByORW X-Received: by 2002:a9d:6f0a:: with SMTP id n10mr19489834otq.54.1580755955334; Mon, 03 Feb 2020 10:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580755955; cv=none; d=google.com; s=arc-20160816; b=k+7abc/ryE1m7nWcrNFVU6J1vfIf+5VbBsk2PKFQ8KuQ8R3bvihmj8sLbWICHKT1bQ Sq1zV8RZoVbn5aIsG1m9AKb08zXT+/JP0CxQWM0UwHbYZ6W+PjkqTsC4JJ+3ZCAcUUDP jHkhImsTcAVotEOFR2M0HvO60HAG4PzgjqWSpCmi7oSyJeiIS6pAQQr6kAfLbHOT5aCM 48O49piKIp7tljv0iwbDWKdbOpswtPzkFucEdZ6LvxZpaE+MBoi56KY5miPNmDY8wBZf ku6M9lC7NyMNtbhQvzrwlAvnH9aRKLehKw4o6Uc8+7FUE1UAlVA0lAaRyp828zTGWUxJ Fb8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AIl5i+iSEvryn4bl3mzru6rU+6y6V4OTKk3qqMEDRg4=; b=zOIQId8/F4TlL+9OhaBGaCGKFQ2aM0JujhdzPJDopPHM8IJxdTBaIBLMeCoL9LZ8kw ovOhQLeDstkPFuAn8VYFS1Oly4ANS29Tfqq12i+N8BZQSVIwYKXnPcjU8YKppGQPia3Z zCCaxKTLxXHDwimvIx3G19yzZiehbJNEiTQGn3JiRGpXuY3SIRO65XdXUa9YZWX/sJ3M OuE7QB1yuxem5oOqVo4dtWEVTo1tXbraW4NQi2sVDepmR0CiP87jFII+xEvJY4BMsiiq nf6m78a5KVkBr2/nJzi7H7j5rv2o7R9yqx2Lg8kEYXCQ3ujYkC0yB5HNa1xoTdQysKMG ZGkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iuXiHaJJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e26si4473261oii.88.2020.02.03.10.52.23; Mon, 03 Feb 2020 10:52:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iuXiHaJJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731287AbgBCQis (ORCPT + 99 others); Mon, 3 Feb 2020 11:38:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:54106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731463AbgBCQiO (ORCPT ); Mon, 3 Feb 2020 11:38:14 -0500 Received: from localhost (unknown [104.132.45.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7FE862051A; Mon, 3 Feb 2020 16:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580747894; bh=CVclESlCh4sxDfLxveJPDtGVWFzcdGQ7O6FFLEyx1Yk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iuXiHaJJEmw6seoyKxNKiDWgxkojMynLTf6dUkej+wwQa+9/ofePYmyt5VzNIbZtd IfPxMpGV2jq9kPtt90AsntImKMQya7pRzojtNbGhwUr7yjlzHblZ57iqCP68adqA3s RqmiVHbsfp1mtN1Cp545PIrVBxrR3RALZ4kUGqog= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Guenter Roeck , Rasmus Villemoes , Yury Norov , Andrew Morton , Linus Torvalds Subject: [PATCH 5.5 08/23] lib/test_bitmap: correct test data offsets for 32-bit Date: Mon, 3 Feb 2020 16:20:28 +0000 Message-Id: <20200203161904.366836024@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200203161902.288335885@linuxfoundation.org> References: <20200203161902.288335885@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko commit 69334ca530da80c1563ac6a3bd32afa40884ccd3 upstream. On 32-bit platform the size of long is only 32 bits which makes wrong offset in the array of 64 bit size. Calculate offset based on BITS_PER_LONG. Link: http://lkml.kernel.org/r/20200109103601.45929-1-andriy.shevchenko@linux.intel.com Fixes: 30544ed5de43 ("lib/bitmap: introduce bitmap_replace() helper") Signed-off-by: Andy Shevchenko Reported-by: Guenter Roeck Cc: Rasmus Villemoes Cc: Yury Norov Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- lib/test_bitmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/lib/test_bitmap.c +++ b/lib/test_bitmap.c @@ -275,22 +275,23 @@ static void __init test_copy(void) static void __init test_replace(void) { unsigned int nbits = 64; + unsigned int nlongs = DIV_ROUND_UP(nbits, BITS_PER_LONG); DECLARE_BITMAP(bmap, 1024); bitmap_zero(bmap, 1024); - bitmap_replace(bmap, &exp2[0], &exp2[1], exp2_to_exp3_mask, nbits); + bitmap_replace(bmap, &exp2[0 * nlongs], &exp2[1 * nlongs], exp2_to_exp3_mask, nbits); expect_eq_bitmap(bmap, exp3_0_1, nbits); bitmap_zero(bmap, 1024); - bitmap_replace(bmap, &exp2[1], &exp2[0], exp2_to_exp3_mask, nbits); + bitmap_replace(bmap, &exp2[1 * nlongs], &exp2[0 * nlongs], exp2_to_exp3_mask, nbits); expect_eq_bitmap(bmap, exp3_1_0, nbits); bitmap_fill(bmap, 1024); - bitmap_replace(bmap, &exp2[0], &exp2[1], exp2_to_exp3_mask, nbits); + bitmap_replace(bmap, &exp2[0 * nlongs], &exp2[1 * nlongs], exp2_to_exp3_mask, nbits); expect_eq_bitmap(bmap, exp3_0_1, nbits); bitmap_fill(bmap, 1024); - bitmap_replace(bmap, &exp2[1], &exp2[0], exp2_to_exp3_mask, nbits); + bitmap_replace(bmap, &exp2[1 * nlongs], &exp2[0 * nlongs], exp2_to_exp3_mask, nbits); expect_eq_bitmap(bmap, exp3_1_0, nbits); }