Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3226920pxk; Mon, 7 Sep 2020 06:58:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpasX4aEsOuS1BAqaCSXDrj5Cc9Ulz5YC/V049EhtiKUvHRTjkDcT+axvF5KgPuJiMGqDc X-Received: by 2002:a17:906:6158:: with SMTP id p24mr2025424ejl.35.1599487103884; Mon, 07 Sep 2020 06:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599487103; cv=none; d=google.com; s=arc-20160816; b=oKa6Mr245jAb0WawK+3PiqVMgEclZfQpYr1jYua4TgDZQu/jxzmnzM9pgBVlYauNXz CPpdHoQHtA9cnxeqjttFCkb5QnNGVIwLMTdFVPmzPI9KuVcNK1EgKr7TYx0o9Sb/WPXj tMRRHaaSFQwcA5pvDZw78HhqHuQUQ++statDYWQtmZK6lP1tFQSDMUGZwoGq6Bvm7Vof EZBxYRlI6LYcmiDf7ap2xEhU+4jc5gYXToGyxXR+Q1+ngDpYYF5QUFB6v3EHx5EagQN/ RoraHOCaxhBjAK2kq2ENRQMkg+dMbIck+v24yDRRB0usht+qSw5dNLqXYjt5IaJ0cZEr lD8g== 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=e9vC6dpeE9V2pMZc4C2LFWN0ajkU1R3cNTDFcMHxK2k=; b=O6y4gW/FYBy382cPDdmRnXC8lgPsS9ZnD6BUFKPbzUYbeLFxcKhRXgHlyLZ1KLga8Q bFST41VBGqu4KtPuPbNNhawbk9PIoNFWUMYOaMuhbEVSi5ffkzz0xckBuAaNLHhUNbOV a3ms/h7//+Jb/U6ODlW0lKUELKR/OB/YeYif1eYxcKTWWWNeReh21f+g+a58JSquh/8v GM5I6Zuhzi+HhP6bItn7KtgHdVGcCtOfMQxvNZD5UKvqj2KdRd//jytgBmDNdpK4WoFn pz89TYuOQEB/Vi1DJkYlq/5SDfj/hbHX//dQGY61XS1U6F68DA2diglHMF083gNtu6bT 6SyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UARSrkQB; 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 f2si9572449edr.143.2020.09.07.06.58.01; Mon, 07 Sep 2020 06:58:23 -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=UARSrkQB; 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 S1729596AbgIGNuP (ORCPT + 99 others); Mon, 7 Sep 2020 09:50:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:40572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729604AbgIGNp3 (ORCPT ); Mon, 7 Sep 2020 09:45:29 -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 21F7920757; Mon, 7 Sep 2020 13:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599485750; bh=PWtmn+Z9RrLCbibZwYxdj5VdBnfGeAWKO2SOBBWHdOs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UARSrkQBalFJiyuplZd86WZgcGkPGkHh4W5UB3z6sPDs/iucB9oO+xQADt4eocjHx a/hL0/+MUz5WolqcV42GXojvatVRW78Ddr5uHibtCwV4KY+/0ANcxtSt5i675YoajP kCiipNsHVLex8nVpM+VaHz/nDMFGtmygwkSiWfkA= Date: Mon, 7 Sep 2020 15:36:04 +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: <20200907133604.GA2779041@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 29, 2020 at 05:43:58PM -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. > > This preliminary coccinelle script converts ~5000 instances treewide. > There are still many remaining instances that could be converted. > > $ git grep -w sysfs_emit -- '*.[ch]'|wc -l > 4702 > $ git grep -w sysfs_emit_at -- '*.[ch]'|wc -l > 229 Can you send a patch that would at least convert the driver core code (drivers/base/*) to use these new helpers so we have an in-tree user when applying the first patch? thanks, greg k-h