From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA0CEC4708F for ; Tue, 1 Jun 2021 05:01:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 96BED61370 for ; Tue, 1 Jun 2021 05:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232861AbhFAFCq (ORCPT ); Tue, 1 Jun 2021 01:02:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:50222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230170AbhFAFCp (ORCPT ); Tue, 1 Jun 2021 01:02:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AE38E6102A; Tue, 1 Jun 2021 05:01:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622523663; bh=kNdCmu0Ne4ouGWs+tyMNaaXD0+25jXNACguOyM29hAI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EGio6xOpGKUO5Y/1X6sQnHGqI+BMLW7JuVUrp5hDecSYs4J/upZ4xeEQtwUFI5coR evkq7WAvgRwpJmBPzUTjeFVgiiwW8qo2k5WPR37bLI5YgCKbLdGcSZWHSpea9wyF5m 3zhYgaJav2C/DNz2N8QtYiX4BbHnKvNTkthdGwi4= Date: Tue, 1 Jun 2021 07:01:01 +0200 From: Greg KH To: Tian Tao Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, song.bao.hua@hisilicon.com, "Rafael J. Wysocki" Subject: Re: [PATCH 2/2] drivers/base/node.c: use bin_attribute to avoid buff overflow Message-ID: References: <1622516210-10886-1-git-send-email-tiantao6@hisilicon.com> <1622516210-10886-3-git-send-email-tiantao6@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1622516210-10886-3-git-send-email-tiantao6@hisilicon.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 01, 2021 at 10:56:50AM +0800, Tian Tao wrote: > Reading sys/devices/system/cpu/cpuX/nodeX/ returns cpumap and cpulist. > However, the size of this file is limited to PAGE_SIZE because of the > limitation for sysfs attribute. so we use bin_attribute instead of > attribute to avoid NR_CPUS too big to cause buff overflow. > > Signed-off-by: Tian Tao > Cc: Greg Kroah-Hartman > Cc: "Rafael J. Wysocki" > --- > drivers/base/node.c | 49 +++++++++++++++++++++++++++++++------------------ > 1 file changed, 31 insertions(+), 18 deletions(-) > > diff --git a/drivers/base/node.c b/drivers/base/node.c > index f449dbb..a19be64 100644 > --- a/drivers/base/node.c > +++ b/drivers/base/node.c > @@ -27,42 +27,42 @@ static struct bus_type node_subsys = { > }; > > > -static ssize_t node_read_cpumap(struct device *dev, bool list, char *buf) > +static ssize_t node_read_cpumap(struct kobject *kobj, bool list, Why not stick with the dev pointer here? These are devices, please use them. thanks, greg k-h