Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp182385pxj; Thu, 3 Jun 2021 04:12:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxToFlZQPyHwJXvVXPgX81QvovlbEg2TLMIFFI/dxU7N5EnF54ODiHqwJZe8eJRoczLYvZJ X-Received: by 2002:a50:bb6a:: with SMTP id y97mr15261434ede.345.1622718727173; Thu, 03 Jun 2021 04:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622718727; cv=none; d=google.com; s=arc-20160816; b=aDC4ObU/TnUUqm/H0m5C59Wvi8CD0XPyQU3y720NKlachoOjaGoK6qbXL4vVeRwl4I Llr1tqexQK6o+NTYq8RWRgPzrAfdctPRNkLJZCki4axqu9yi4pxwxUIylP4ehueDRajH BDgFwhxZBBM5qZBKDJmF4zSutFf6361woKHmtnw6x0m+gMgWgv5akPIRy7Ov3JeAAjL/ NNcHMfscNz+qVK7aCYa0PRY0RPWX3ZOlQHoZQjB0DEq9pVvjdsR1FSBMznMwMM4ssymm TUUTgdG3vh9r1N6xEZtRbiETmIxNS9+gF2MpHC0eh5Z7uOX9I1uqhN8QFcoeXs2pIqlc qT9g== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=+YzmdUkMHWZEW2ZLpOzM18m+Tel5yS+XaUf7juFZMWk=; b=hzmhCqSWDZ0hKJX6ly1lN7FgWFkj/bT3Xzo4AADB45yWxnnJYIggl0rL3//ps5gsq9 vp5y/EzrWqj7gQUhfgh8eGL5l9A9faGm2yWcNsSMkFDbuRgSt4vmY5z9748SzoguKKXY 4xEZDUGcezT7jQqsFqimQUYiAcltL01K39aMbRZI6Dl4XpYxQRcenPoQZ3C8U4AnaKdF o5jjBYzhDVSjfKFGWpMHDnlAdGWhLSR29gm92nf2tNznfhmtTWLz3vWsXe5uaQEvNDMS mkijhReFXTpSzOHhxjWgJc/A604uIJCLtg9CP/nfIrNyLBfFixZSHRd3dIg4GlyrFoUi 006w== 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 z40si2256188ede.300.2021.06.03.04.11.40; Thu, 03 Jun 2021 04:12:07 -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 S229801AbhFCLLr (ORCPT + 99 others); Thu, 3 Jun 2021 07:11:47 -0400 Received: from mga07.intel.com ([134.134.136.100]:19667 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229721AbhFCLLq (ORCPT ); Thu, 3 Jun 2021 07:11:46 -0400 IronPort-SDR: p/duha5OTsNP2IHPFc1AMxiukk1DBRNN/5ujbsLG/lOGw4wqn/ffHj+7EEDF4fqVXHd8cpXB3R haibs1pb30jQ== X-IronPort-AV: E=McAfee;i="6200,9189,10003"; a="267883616" X-IronPort-AV: E=Sophos;i="5.83,244,1616482800"; d="scan'208";a="267883616" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 04:10:01 -0700 IronPort-SDR: 40NLyzidrZVMzwXe2ce8BRDdTxNEnxAEH35sFi3l+yfgrveLgZpizD2GHJxMBSPUI9LyK6ybFv r8lrwFardnqQ== X-IronPort-AV: E=Sophos;i="5.83,244,1616482800"; d="scan'208";a="483433819" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 04:09:59 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lolEa-00GvRp-QS; Thu, 03 Jun 2021 14:09:56 +0300 Date: Thu, 3 Jun 2021 14:09:56 +0300 From: Andy Shevchenko To: "tiantao (H)" Cc: Tian Tao , 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 06:31:57PM +0800, tiantao (H) wrote: > 在 2021/6/3 17:53, Andy Shevchenko 写道: > > 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. > >  I can delete the line 55. this is the only problem, are there any other > problems? I don't know. I'm not familiar with the area. -- With Best Regards, Andy Shevchenko