Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp137643pxj; Thu, 3 Jun 2021 02:56:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3LEFbiuFOiPVD8tcnvG9NG913aoHP75AAsAcx3DWP9qZBlVgBcUa2bbTLnwfuxx3hTvgE X-Received: by 2002:a17:906:3888:: with SMTP id q8mr14431181ejd.15.1622714214536; Thu, 03 Jun 2021 02:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622714214; cv=none; d=google.com; s=arc-20160816; b=gQ5QVtLg08Tx/+Gnf4Z9SDoP95AtKxoO92q6D9CAmW7Md7LYcb3Q0nMfIARsZZUFm0 Vii6N5lwU/W/Ai1dqdBzH9ybj6qTThkCWDcFg5aG1MSg4JiyLrgBkR8ehQzF3DOCWuuP ZOQzWfupc5qDo4TN5Q6qjsogPi3MC84fCxF9/zMIZU3nZzTxVDgA2a/jjFJVt71M5MgB VYjUAgJJRZ4rDdCM0G+Q6tARfk1M4YR45f1PFvlQIC//g8bVywBw/gDlMHp9NT9/nqro VdR/EVKz9y/V1XVuk4dqMX5eH/l5/tumRPCo3ztMNFkvwWYwxPXRuF/GHBReWVO8G54g 2Gkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=J/oYiwDiS6oNVIlKNzW15n+sQhdJTbLbMHBQ9FuDzfM=; b=IDlQd5xw+g2PVlCvS0DtHsJdiVJ6aX1Vcap76gIvg4mGm0Yfxd0B9up9FO+rAdhMqV ew4OwfPoNV0BfQlHgdYVB+45MsQMOkiGAMvcoBS/0M8dBIv/R8DXUzpyVZlx8v83jCHY R2eWJ32zghlLJChliiXH/aAzzC5y5Wb78gRvltxI9THetfPitYZtaGZE/zWdyBOXIS/I q9dW8kGQcswjoI238yzuRQ6dxAwJYas9B2KQl9qC/iYJBArTvmOdgMdxA2N0sZdMgjMp kJGWmHFNjZmtXSWH/Ak9P2h3g4U0jMRMCZKoS/x0wi+s71hSZ6BfctFkDC1HHwgB6KN4 EkHA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m11si1928516ejc.708.2021.06.03.02.56.31; Thu, 03 Jun 2021 02:56:54 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229719AbhFCJzI (ORCPT + 99 others); Thu, 3 Jun 2021 05:55:08 -0400 Received: from mga06.intel.com ([134.134.136.31]:44240 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229661AbhFCJzI (ORCPT ); Thu, 3 Jun 2021 05:55:08 -0400 IronPort-SDR: YSK4tgk1LlxGNK/cPWePiSadLqj7YB+5ingjal3DtmUpHnmcIkQcCVxaIS1vs93oQR5qBkKtYm 2z8pmfxkUh3Q== X-IronPort-AV: E=McAfee;i="6200,9189,10003"; a="265180960" X-IronPort-AV: E=Sophos;i="5.83,244,1616482800"; d="scan'208";a="265180960" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 02:53:24 -0700 IronPort-SDR: uyEPPLgSCDKNELgIyYb6qvYzhUNE1Jz8SxVKSdd+x1yvjeQLF/YhYhlIvTPl2PwDFFOFfU3q7M IuCIWf6ZDSsw== X-IronPort-AV: E=Sophos;i="5.83,244,1616482800"; d="scan'208";a="550638310" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 02:53:22 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lok2R-00GuWe-Oc; Thu, 03 Jun 2021 12:53:19 +0300 Date: Thu, 3 Jun 2021 12:53:19 +0300 From: Andy Shevchenko To: Tian Tao Cc: gregkh@linuxfoundation.org, rafael@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, jonathan.cameron@huawei.com, song.bao.hua@hisilicon.com Subject: Re: [PATCH v3 3/3] drivers/base/node.c: use bin_attribute to avoid buff overflow Message-ID: References: <1622712162-7028-1-git-send-email-tiantao6@hisilicon.com> <1622712162-7028-4-git-send-email-tiantao6@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1622712162-7028-4-git-send-email-tiantao6@hisilicon.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 03, 2021 at 05:22:42PM +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. ... > } > > -static DEVICE_ATTR_RO(cpumap); > > -static inline ssize_t cpulist_show(struct device *dev, > - struct device_attribute *attr, > - char *buf) > +static BIN_ATTR_RO(cpumap, 0); So, you will have 2 blank lines in a row after this. Why one is not enough? Same question for other similar cases, if any. -- With Best Regards, Andy Shevchenko