Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2986683pxk; Sun, 6 Sep 2020 22:49:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/BSIUpuf8/7YPnwcANDMqLxcCjONOfdD4KHY3FYutWnMIjE4vNdQRI21T/q7AxiMqtS+L X-Received: by 2002:a17:906:4d97:: with SMTP id s23mr12266336eju.157.1599457788701; Sun, 06 Sep 2020 22:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599457788; cv=none; d=google.com; s=arc-20160816; b=XMyeDW4UtN8hQj7++hbpYCWoZzYdJyoTwzkwA9gXuDT++d0Z8ixBReYqrfqbYwBCJ6 fzx7VCDAQADhZd4EZgVfj7NTeRiupXZCekPWkRJlFN9VMHNQxhuOu6ZET314j8MEFTlc ZTdLIrFRZNcrQOdPpx3XVFG+VrmTyrv/gpEQBg6mrL3q+pM+lS2aicTYqhuXvaUdIXSp MZCuZEBz/unXAtvpFSVJ6P/OCN2+0JOOo6KfHLZd+L7C3b8M+zqY2WBtw79gsB52fld0 pA3bY00Wu/8kZy//oQRBhVmMRCvNbNxYOUBO2vFiH3mTswtN04PUn/fGTgfHGpcklQdi TETg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=h8QdgdLGczUvam7jCOYVf4k3OFXZinOFwCcNxTMsQls=; b=0BGyCPHW5jfb4Vejrv5/Hx78erc7PEWZUr67/mTT4P9RrWnlw5vbZf6OrIwd56XXYK VF7w+XIpAFwPxbs8v0uouXNjCKALYZWVkRASGchNCLOtxzeSPDhHL6hGFyfqZsyI145S nhqzevLK7Pq+C8Qnr7whmzvqRooKS1x5SkKiTeJoMoTE4FO8VmvwrRrlkRIGy9pMtIms rhRLFqCfLWEWyk6SoVbqK8N1RnS2NTYRtjKyEzdUyeKSGLLd44YPE74W6yDdYaoHvXkE 7ci2XFcz00Qa2dGq5nmULFZ8kg5A6GwTLo4ChKwnU8zym2HaePzHpNaC/iORYkzezdWG fHjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D1ehEq9C; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u59si9499497edc.226.2020.09.06.22.49.26; Sun, 06 Sep 2020 22:49:48 -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=@kernel.org header.s=default header.b=D1ehEq9C; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727044AbgIGFsl (ORCPT + 99 others); Mon, 7 Sep 2020 01:48:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:43850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726984AbgIGFsf (ORCPT ); Mon, 7 Sep 2020 01:48:35 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8C64B20732; Mon, 7 Sep 2020 05:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599457713; bh=kydM5vc3pHKLMrAc5q87T/B4UAcHcYV48KRlM3SnTaw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=D1ehEq9CdIVbqmWoEHkUdqqgpOZdOsGk6sVQrIriOlwsHsWUJjXVyryp/ZUtQRFd9 NhnMKZK8bCPo07ZJ4OWGs/bAPS0/rDx+F+hdFQEF/edLZwQHLT11hlOx19g5WunOqR OYrY9/w+NhajnG4XRv/89VnuMpCly0RC2oSEPyVU= Date: Mon, 7 Sep 2020 07:48:29 +0200 From: Greg Kroah-Hartman To: Joe Perches Cc: "Rafael J. Wysocki" , Kees Cook , "Gustavo A . R . Silva" , Denis Efremov , Julia Lawall , Alex Dewar , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output Message-ID: <20200907054829.GB280798@kroah.com> References: <743a648dc817cddd2e7046283c868f1c08742f29.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <743a648dc817cddd2e7046283c868f1c08742f29.camel@perches.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 06, 2020 at 10:24:20AM -0700, Joe Perches wrote: > On Sat, 2020-08-29 at 16:48 -0700, Joe Perches wrote: > > Output defects can exist in sysfs content using sprintf and snprintf. > > > > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > > used for outputting sysfs content and it's possible to overrun the > > PAGE_SIZE buffer length. > > > > Add a generic sysfs_emit function that knows that the size of the > > temporary buffer and ensures that no overrun is done. > > > > Add a generic sysfs_emit_at function that can be used in multiple > > call situations that also ensures that no overrun is done. > > > > Signed-off-by: Joe Perches > > --- > > > > V2: Simplify sysfs_emit and add sysfs_emit_at > > Include Documentation change > > Greg? Rafael? Thoughts on this? I like the idea, give me a chance to catch up on patches, it's still in my to-review queue... thanks, greg k-h