Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3079671pxj; Mon, 31 May 2021 19:57:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9zChfmbuXOEQ7wuW9AC8zPc3Pahd7hMg/sMbPAUuF3GHoqkidjzD64y+oTVKmqypoOh0a X-Received: by 2002:a05:6602:1815:: with SMTP id t21mr19552569ioh.193.1622516270040; Mon, 31 May 2021 19:57:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622516270; cv=none; d=google.com; s=arc-20160816; b=R2V1viPW52JeOfMgi6r0nrWKwNf35j4PbbsAEmTe5CYiPgNdPb52wgnfLwx/ftwMbJ mhG5qhPCJm9Eg2lnvN9lwXiySE2o4w38v6KNHMt+ZFTrnXNRkyinkLQNtL65tylaIQgM b3G83Ptn5zAFTXlJMKgG9/f7hv+58s34C1dd/x9pZpqz30V0FpXcJlEhgxYlGjSvKYmh SnnFIBm/cu8OD3l3zwev9TExJQKPzUWKZ0UGk7g22Fjxaq1RP1eKHuOwUnph8qJNUHSv qoPYSHli5YcWR3MKo7+HZM+po6o1v95wxxUc+1l4q5dVJlOgmH9ZNAjUQi0fEPRF317A jPbg== 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=cYW9qkV1Cx16s2BCcVhQ07msbShTOQz+oXRTgKDJkj4=; b=P0zieN11QI+Q7Hhx1hmsEMRjwrW+fzphgVqVeTGI8BYU5dfkDxv2+p3o8Hr7yX8ueD UwZa9Or2IV6UNmMlgHTOQGFCp6rZOS1mBrm+ohLb0xdNRFhWrL0IHN94WUpMkO9ydtfE XdnnN+7R0AecNKIslbzBL+Zg7Cjaf5STLNkYrlhnJrEcBG45cVCA0n1ENK5+Ci7K8iUq Z3WzrhpwMqd6vdPi9j2YY+0GV7ljY5MoDn1bYK80ZDZANAh1jMmmGpbNJTOdPrtcJpg2 atKK0IpOLyv7Xe21wbMS36MeEW4HgruBdLeAYx86ASzC3+Nm1IKbxOynkdyVQD6hWYvW +6Kw== 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 i19si10085637ilj.131.2021.05.31.19.57.36; Mon, 31 May 2021 19:57:50 -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 S232700AbhFAC6s (ORCPT + 99 others); Mon, 31 May 2021 22:58:48 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:6099 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbhFAC6p (ORCPT ); Mon, 31 May 2021 22:58:45 -0400 Received: from dggeme759-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FvGvt2ttjzYmbn; Tue, 1 Jun 2021 10:54:18 +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; Tue, 1 Jun 2021 10:57:01 +0800 From: Tian Tao To: , , , CC: Tian Tao Subject: [PATCH 0/2] use bin_attribute to avoid buff overflow Date: Tue, 1 Jun 2021 10:56:48 +0800 Message-ID: <1622516210-10886-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: dggems704-chm.china.huawei.com (10.3.19.181) 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 The first patch adds a new function cpumap_print_to_buf and uses this function in drivers/base/topology.c, and the second patch uses this new function in drivers/base/node.c Tian Tao (2): topology: use bin_attribute to avoid buff overflow drivers/base/node.c: use bin_attribute to avoid buff overflow drivers/base/node.c | 49 +++++++++++++-------- drivers/base/topology.c | 115 ++++++++++++++++++++++++++---------------------- include/linux/bitmap.h | 3 ++ include/linux/cpumask.h | 25 +++++++++++ lib/bitmap.c | 34 ++++++++++++++ 5 files changed, 156 insertions(+), 70 deletions(-) -- 2.7.4