Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3151677pxj; Mon, 31 May 2021 22:02:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNFeYL6mrDFvtPDzUlpuFCYrL5HO7q3owLAaoCEiX3ENX6aN3d+lt0Ucc+6h5ZGLxRcnk/ X-Received: by 2002:a17:906:a0d3:: with SMTP id bh19mr27501489ejb.205.1622523764380; Mon, 31 May 2021 22:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622523764; cv=none; d=google.com; s=arc-20160816; b=0tKdPd0vZTTcZP9i20wnr+IfIfuQWq2Dmy/jtFbZqprGJ9l92Y9Gc1AMf2rKTwR+rL 3ZSGQBUkDwIbbOy3UnZip/BS0I36bYOYp3tqUN+AdjSzChPurtjPq6e/2oBF7QzvPdpE JZ4xnwhxhj8kbUvT+VvSWn0umOGcZqTXYYk4vet03mG/SP88/Tif6leJ9Hoac501gjck 9Cm5RRoL3wj5W5IjAxR9sOIClhROyg6HRDL/UKq7oqMJlGgREC9fS7gsiSyPUvtR4E9c EA4Ss7eAhjLQj9x4bQtLmqctY9jdzS9vRnHh/3jmmoia5/DRhVVkg03wuaChxGRCxMxb df0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+mzy9YfOcALbIw9y8EfblC8oN1mYUzLxRh4vfhHJ9uc=; b=kOvURgOnrP1Xe9CINqB7liGHh5XsKDXIJ+0DaNvPc9y/jzD7pLXw2NLsTETISJ+Eqo VoB47eKqAPDqClSk44ale8E89oONMnNieLV96t1XcfG1/mrXu2QplsiL9Xt6K3MVypvS ZA8lWVkQ9P5CGO932wWj4z4WA4Nc5OVsbG1rDRJm1dVapqG0MvRiUthJG3WMLG4hqq/j aV0J9iFk3v+9DThGtq8j2afuxOpyEFU3pvlux52nxhVQV13GDBkk3puB9zA7viJtAvhL uoNFaQkLSHU6VS7ZI1jhTwqhAQCbXsC4yA2Upp5ljaIswXR8SP5ibuvG+7FHsUOHcugy kMpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EGio6xOp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y28si19019ejk.356.2021.05.31.22.02.22; Mon, 31 May 2021 22:02:44 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EGio6xOp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232691AbhFAFCp (ORCPT + 99 others); Tue, 1 Jun 2021 01:02:45 -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