Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp592704pxj; Wed, 2 Jun 2021 06:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNTTNfJUjBmhN00I+G/IGUNdivgd9ms39bHmsKCz0CFTa0zoGk6jfBWPJ7aBjKSDcoT6Oj X-Received: by 2002:a17:906:d1d5:: with SMTP id bs21mr12045502ejb.378.1622641866357; Wed, 02 Jun 2021 06:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622641866; cv=none; d=google.com; s=arc-20160816; b=Aq+jpkh3NXU6a0ef0Ga83xX1GWW1uVmPhIJtG9IUCgcGRCjWDY2OAxyiPQYeguLvxB aw0WZbXa2fEwMAuuBP7uaBbOkLXiEMezxQVrFmSuSjlpAgxasbga+stti14nOWvZeBA4 G4eSMYuauersq0GdqfClvlmTiAHCqNIDTRyDzB1STWY2MC4nzMlsKKp/rkVjh40GaXmi VjYkTY5uIbBJ+akY+Dq1GVhgHAI9Z3KErog6Qd5nY1OqQ83nXwWy3TX40tLcLHXR75m4 OuGrlQxLh4fsfei2kCMAi397332XlhlC+fYn4cmvrNwNqWImpl/vnBV9yNpYULRfDRTC fLjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=8ZlyxDjNrHzORpLeOBgQ4BHsX4zCUlTZ0K5oKpmKpOo=; b=mWhsD5IbQKTqE+U0EYl8HiKEpWHYtle+DAhfK7YVigcOh9RjzyUECMpjwYfSGoFdBs SKps1Wjb6B8z8lSo3nDhRvM7dmUYch2+qXLM15ms2TBXIfBk7k0PpH0uKnqfSC2yrHDn GB+aKjwyyKo7jKWxI3Wo67Ricw51zN1dlj0ZzDEjNp9L5NswUJ6GfSuRV9njoVeIiGPI NQvtTu5Dhr9+8P20Xf/rsUKNKRKYiXfrLBbU0Od9vSsmyq8RucTiSPzQf+mrTUQ/rwBb vIN5/0ISavUL0pq7AWR3lXZCRFRntkB3lrJUUCrLxwS8noi1i0p4wrVk2p0Hl97IGssi 4nbQ== 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=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u16si2137927edt.569.2021.06.02.06.50.43; Wed, 02 Jun 2021 06:51:06 -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=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229852AbhFBNuz (ORCPT + 99 others); Wed, 2 Jun 2021 09:50:55 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3513 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229762AbhFBNux (ORCPT ); Wed, 2 Jun 2021 09:50:53 -0400 Received: from dggeme759-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Fw9Kn3dVxzYrvs; Wed, 2 Jun 2021 21:46:21 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggeme759-chm.china.huawei.com (10.3.19.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 2 Jun 2021 21:49:05 +0800 From: Tian Tao To: , , , CC: , , , Tian Tao Subject: [PATCH v2 0/3] use bin_attribute to avoid buff overflow Date: Wed, 2 Jun 2021 21:48:51 +0800 Message-ID: <1622641734-22538-1-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeme759-chm.china.huawei.com (10.3.19.105) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. v2: split the original patch #1 into two patches and use kasprintf() in patch #1 to simplify the code. do some minor formatting adjustments. 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 | 38 +++++++++++++++- 5 files changed, 157 insertions(+), 72 deletions(-) -- 2.7.4