Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2491948ybd; Mon, 24 Jun 2019 07:21:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZfB087aMAt4Lm6mooqLrDQitqehmVC15fLDBz0zugmB6HSeFY8MSuRzvDQkc3SiJ3TT/B X-Received: by 2002:a63:4c14:: with SMTP id z20mr33043491pga.360.1561386089184; Mon, 24 Jun 2019 07:21:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561386089; cv=none; d=google.com; s=arc-20160816; b=bHNzkVYcvK9pThio7jTd9X3heIOwvKKzN10pEjNZXrKAg59KBiUdgzq7QjdIg9cu6G qrnCCOdlsUDQyep3AkcfC0UVz45yjio4chwKMtrAABpoaibl3PqEZ25yCODZvOnFRYA3 Gy3YxSO4CvaB2bz0SGIwkyIuCsMBJjy7tWBxrPRiI+oRAqlAVM9JvziTRnIJbAsR7IFa BMNmu2tXqnOvgwbStmwTqD/j4S9IZN7e6cA5uslIL2doNuRYVCQSmvGAZIjOjs6D9/uz +XAKTNu4mxOJCmSeBYNMFhlAyJ32skTFwmmeLUdnWmscBMJvofZX0CcgdaPge/jvB0xN CJJg== 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 :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=e3wihO1J2dJYUxiWQDpNSE4ux81JjShRH0u0Yai1aow=; b=R9k5R5sDsaeYxaLKgK98hc2OX3eZyEuyc4H+Lxw0XYj3FKfJAoM3BnxufzyqzQJwfL dvopETwFACVPdLlVoXA5cuUnuHAXfXvh38S7KLEzelwVvp62JfZUXhXydwX80bceVThT klH3Ru4fYMlsRII0BMARu8UHnD9INzZxtYFKBknOm0Rjn1rSbPv1h0ltVlz+ERMVImZM KxWhzuejwheB9M0+veBCuzfE1+2ZfeTmq+vnXzvv4EZywK0bohRxHHfOFHYVTq8/i5sB LsDSxOe8YzuIb3L1PVY2RHAmdHXI9n434X6UoXcBTZ9y9dMC7eeoAOfWSGTMskPzn1BW Qg+g== ARC-Authentication-Results: i=1; mx.google.com; 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 l9si8557376pgp.429.2019.06.24.07.21.13; Mon, 24 Jun 2019 07:21:29 -0700 (PDT) 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; 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 S1729261AbfFXNzM convert rfc822-to-8bit (ORCPT + 99 others); Mon, 24 Jun 2019 09:55:12 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:27378 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726716AbfFXNzM (ORCPT ); Mon, 24 Jun 2019 09:55:12 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-154-zyOnqJgCNBeziOcEpui8zg-1; Mon, 24 Jun 2019 14:55:08 +0100 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 24 Jun 2019 14:55:08 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Mon, 24 Jun 2019 14:55:08 +0100 From: David Laight To: 'Reinette Chatre' , "tglx@linutronix.de" , "fenghua.yu@intel.com" , "bp@alien8.de" , "tony.luck@intel.com" CC: "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: RE: [PATCH] x86/resctrl: Prevent possible overrun during bitmap operations Thread-Topic: [PATCH] x86/resctrl: Prevent possible overrun during bitmap operations Thread-Index: AQHVJt2gKCUy1MDNR0eTZZQcuzstIqaq2mhQ Date: Mon, 24 Jun 2019 13:55:07 +0000 Message-ID: <2b15f4ce814a425c8278e910289398c1@AcuMS.aculab.com> References: <58c9b6081fd9bf599af0dfc01a6fdd335768efef.1560975645.git.reinette.chatre@intel.com> In-Reply-To: <58c9b6081fd9bf599af0dfc01a6fdd335768efef.1560975645.git.reinette.chatre@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: zyOnqJgCNBeziOcEpui8zg-1 X-Mimecast-Spam-Score: 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: Reinette Chatre > Sent: 19 June 2019 21:27 > > While the DOC at the beginning of lib/bitmap.c explicitly states that > "The number of valid bits in a given bitmap does _not_ need to be an > exact multiple of BITS_PER_LONG.", some of the bitmap operations do > indeed access BITS_PER_LONG portions of the provided bitmap no matter > the size of the provided bitmap. For example, if find_first_bit() > is provided with an 8 bit bitmap the operation will access > BITS_PER_LONG bits from the provided bitmap. While the operation > ensures that these extra bits do not affect the result, the memory > is still accessed. I suspect that comment also needs correcting. On BE systems you really do need to have a array of longs. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)