Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp134895pxj; Thu, 3 Jun 2021 02:51:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5TUCQXCcEQuiSet1gmmpmGXTG/bTuKIhjpnbhmfeS3GBf8vt5yrO36oqykPejpEwT58jL X-Received: by 2002:a05:6402:274e:: with SMTP id z14mr7500241edd.66.1622713883533; Thu, 03 Jun 2021 02:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622713883; cv=none; d=google.com; s=arc-20160816; b=aHudGqzHHSUuRZGiAHvWSizkbCXC/nuATM6T5IZ8qHP2LhB8HiVHJZ2wkps5hlP/NA 7sRXx4BtRbYMxgE6o65zL9RnbZNpSIr+l55HlhPIWcqWO8kV15+5Cf5e/g8Wzvd9qwdj 1fDtOUzPUYnV99YvDwGrRR7UyS+BJA0tmicVfXsJZDfKPPJNY1Uf1MB5LisLJ/RB05tg LnfBUAPln60YN1qtS/jiS2u7nsTRzjByaTIJ3A9scWw+dMbbiqtth6wbBO7+aQ3xFxfB mqwUGWuQlO0gSmWTIHUj5PL16Da0Il7OE0QSZ+h2Pw2c+PrPtqD4BGuAGD4aOyFloEZp x0vg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=9nga9n2dBze5kPAsHyOmtiopz2vvRuqo+S+wqwASMSo=; b=mMWmaIvT41L9rZm9ud4iFBMMwvWSfIO9DIo6eOyTq8QIwc4InEzTG0sWePw28LmqzK 4xl3FUhDPzy/TMhtDWv4EacYUYjvgZSfvfTd+a7Vbo8WMzp3m9JhBwz5NsI3j6Dx/gEh LcIiLSNDLeGv5rUZaVCUJ8+J11OrAIwHw2lngY4UwiKAHQ1F6IboECPDCjUUtArAdNum u2D3K5QmXb/gpQGimkAdgn75Ww89G87VYeWI/h+qF4e68IENgl/rGF9fVprrhnpARQlZ lmbYF8+i8y+Na9ZPWCNw/Jm0BU9MaZXHDekZ0HvwYnGhDa0738XCzKSOviw0IdvcskYB Ue3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h21si1759765ejt.172.2021.06.03.02.50.59; Thu, 03 Jun 2021 02:51:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229665AbhFCJvq convert rfc822-to-8bit (ORCPT + 99 others); Thu, 3 Jun 2021 05:51:46 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3135 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhFCJvq (ORCPT ); Thu, 3 Jun 2021 05:51:46 -0400 Received: from fraeml740-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Fwgv34Hg6z6S1MR; Thu, 3 Jun 2021 17:43:27 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml740-chm.china.huawei.com (10.206.15.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 3 Jun 2021 11:49:59 +0200 Received: from localhost (10.52.126.9) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 3 Jun 2021 10:49:58 +0100 Date: Thu, 3 Jun 2021 10:49:57 +0100 From: Jonathan Cameron To: Tian Tao CC: , , , , , Subject: Re: [PATCH v3 0/3] use bin_attribute to avoid buff overflow Message-ID: <20210603104957.00007d1d@Huawei.com> In-Reply-To: <1622712162-7028-1-git-send-email-tiantao6@hisilicon.com> References: <1622712162-7028-1-git-send-email-tiantao6@hisilicon.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.52.126.9] X-ClientProxiedBy: lhreml725-chm.china.huawei.com (10.201.108.76) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 3 Jun 2021 17:22:39 +0800 Tian Tao wrote: > patch #1 adds a new function cpumap_print_to_buf and patch #2 uses > this function in drivers/base/topology.c, and patch #3 uses this new > function in drivers/base/node.c. > > v3: > fixed the strlen issue and patch #1,#2,#3 minor formatting issues, thanks > to Andy Shevchenko and Jonathan Cameron. > > v2: > split the original patch #1 into two patches and use kasprintf() in > patch #1 to simplify the code. do some minor formatting adjustments. > All 3 patches now look good to me. Now I just need to get access to a system that actually has enough CPUs to need this ;) Reviewed-by: Jonathan Cameron > Tian Tao (3): > lib: bitmap: introduce bitmap_print_to_buf > topology: use bin_attribute to avoid buff overflow > drivers/base/node.c: use bin_attribute to avoid buff overflow > > drivers/base/node.c | 52 ++++++++++++++-------- > drivers/base/topology.c | 115 ++++++++++++++++++++++++++---------------------- > include/linux/bitmap.h | 3 ++ > include/linux/cpumask.h | 21 +++++++++ > lib/bitmap.c | 37 +++++++++++++++- > 5 files changed, 156 insertions(+), 72 deletions(-) >