Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp153670rwb; Wed, 9 Nov 2022 00:03:20 -0800 (PST) X-Google-Smtp-Source: AMsMyM7azZxuh2pEk6L78tI+9nM3zWq22CI8I2c4A7U0nc/WQxtGN0sF0mA7QAWLGc+8Tc6tuPzS X-Received: by 2002:a05:6402:a46:b0:461:ed76:cb56 with SMTP id bt6-20020a0564020a4600b00461ed76cb56mr61965127edb.264.1667981000126; Wed, 09 Nov 2022 00:03:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667981000; cv=none; d=google.com; s=arc-20160816; b=Dskx0+L4tsY4wOy/ufnqOXjDd7FEnA/6CHTdWZZTbRMiMy0L+4NhDjrmNBDLV1aFuX z019nSCLPgKauQpPSFqJSnguy3FlJJSf/VRSilbpBBb6Ofj45v7qTI/XX4ZjNxJL3LKv XpGH4x2dwsmvSLTxOH4O+VvEGw/YPr0uSzCONFQ2TMC9HY/SD4RNPqnYPvpiSeQrjl0A GFAZtTJZ9zbKgC5EUwE7i/ItAGGEVy/ptVfGgDLqDlcHhfYcKi0w2sUT/Y7sUSfOHg7i nFbPxnTtpaSH69opjv8YiaH7Eadzdwm155v6PHdg73kRw9hMpxpJVrfjeMTJoxEk4l2j yF7Q== 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=30YyiHzs+hdxIozi2wcuCcRB54fjRB2LhCHhO7ikiTA=; b=yCU0uQERUPBuHnyEVt90KO/kAahQDAKFNDQTYD/7gBe9NL0BP9tOeHE288B2fJJe0e XptmGjxGvBYJXJr9a5n/hcOVEiq8oEvWVO+57dulxaEAL3VdNSF2jKJBfKtXN2W5F0j/ d4NeOUDFhPnr8dldW7BXdwUBpt3H+XRWWv1+C/20HuQcKpGlGjgShid5CsJrVKm/Rtem KZxAuCzpiyHDVghwseQSZmLD9FdmU5lTO+ysh06ETar3Tfs2q/TzSiDQtk8zvbJ3bYMR d7vdGnPWfE7bu6v6F663tYY8hQTYeWHTQbYSw3KxOBUA5BspZn5bqVx6jPSrbOCl0G6b LAug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MKbJbSnP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a056402280800b00457263f9ee0si16174461ede.93.2022.11.09.00.02.53; Wed, 09 Nov 2022 00:03:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MKbJbSnP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229907AbiKIHas (ORCPT + 93 others); Wed, 9 Nov 2022 02:30:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbiKIHah (ORCPT ); Wed, 9 Nov 2022 02:30:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A3A41EEF5 for ; Tue, 8 Nov 2022 23:30:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 31B2B614D1 for ; Wed, 9 Nov 2022 07:30:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C5C0C433D6; Wed, 9 Nov 2022 07:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667979029; bh=A7qt0zFqAaMzmKHQqsEQpxmG5gXY5Z/MDjAh8xxm+Gs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MKbJbSnPC/vbm6nr0l4ySwZbWNlOLsm4jzpCufyhgeV8ORzOrhSpquySZriHG1/Tk h4A4fJNBqvNNQ1kHPeSpc/xqDaVOuBzakyMuE+5LTg1D9aJVD9T6Z4KjJIC8lSQMXs Nrb96WvDIgbV94vy9Prf5Huj0GWzGZEeb6IVzF9I= Date: Wed, 9 Nov 2022 08:30:26 +0100 From: Greg Kroah-Hartman To: Deepak R Varma Cc: outreachy@lists.linux.dev, Sven Van Asbroeck , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] staging: fieldbus: replace snprintf in show functions with sysfs_emit Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 09, 2022 at 11:26:52AM +0530, Deepak R Varma wrote: > The show() methods should only use sysfs_emit() when formatting values > to be returned to the user space. > Ref: Documentation/filesystems/sysfs.rst > Issue identified by coccicheck. > > Signed-off-by: Deepak R Varma > --- > > Changes in v2: > 1. Switch to using sysfs_emit instead of scnprintf > 2. Update patch subject and log accordingly > Feedback from gregkh@linuxfoundation.org > > > drivers/staging/fieldbus/dev_core.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c > index 5aab734606ea..d32599f4eb44 100644 > --- a/drivers/staging/fieldbus/dev_core.c > +++ b/drivers/staging/fieldbus/dev_core.c > @@ -67,10 +67,10 @@ static ssize_t card_name_show(struct device *dev, struct device_attribute *attr, > struct fieldbus_dev *fb = dev_get_drvdata(dev); > > /* > - * card_name was provided by child driver, could potentially be long. > - * protect against buffer overrun. > + * sysfs provides PAGE_SIZE long buffer to take care of potentially No need to ever mention PAGE_SIZE at all, this comment should just be: /* card_name was provided by child driver */ But the larger question is, why did you only convert one of the sysfs show functions in this file? Why not do them all? thanks, greg k-h