Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3801949pxb; Tue, 19 Apr 2022 10:05:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9G8X67KIbd4NpkTFThqMVqiu+wPY0LHPXg9ShQNqPVic9X2MXvO50WLwFI8eo5S0vMKMR X-Received: by 2002:a17:907:3d89:b0:6ef:eebf:1708 with SMTP id he9-20020a1709073d8900b006efeebf1708mr2210145ejc.620.1650387922276; Tue, 19 Apr 2022 10:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650387922; cv=none; d=google.com; s=arc-20160816; b=wayl5ydaGUUYH861ASTZryN19vCydxUVam/B7208f/OLGEhcvz5pYCL3QoLWdUaK1c 846Ffp2azD2S0pc8VDV/FS0P/UQpQ22dzxmTzFx0K5I16u01jZblWPsJxPgttZDBGcGE NLNtVbyxdCzRUXVV0HsWlminmljyGhr3Y6OZ5OmdeVKFIv3QK+V4FlcYouDJ3fitQtsg QZKk9i8PTzBO3qRqHjstF/+yJ1Sb2rb8Kkc63fOUlSTSIkTsMljGZ9mCnVqTiv/ZWhnu +qETKoccAUYJfWvzrW939Rqfwhp2AX1a/46Xr5K/xEK57lIVjWCLYZJrpmPN/Ur5v+LC S2vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PndP6HW7eo6osITNaTJfJ+gcwkfxKtAe9lsjLNgiQ2M=; b=NJ3IHgreUtF8caQNF4pu8DRKDmpPIymlj29nbxI4qEHoaukIpb0MQdXQ/biL0tmXHH hftqzJoKG8ow8Huc3ivq/QCMoneXctXc//gNFJfK44KnGvETshwIzZ7aA3odyd9W7Fid 33wiIg9YZxc0jOwSrMJ0SqcB8nEEuFhqChMwpEHdGxJPSu87CDtPiCINbaFx8WyVvj41 Mk8hBYZ0tIBFCcvWVMGBmKN+n5wok+ARgz2C8wKLHfkMXTsP5McMBWzUgJ4pFSVdY/kI UFyAfQkjCc/NntJbDKbzVs5uusQ1uKPv7hQrbO0XPPULErJGsGq/8/j8lWqRBxN7Rc+F FNIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JuqKFRyk; 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 g12-20020a056402090c00b004232a7fdbbfsi9274834edz.410.2022.04.19.10.04.53; Tue, 19 Apr 2022 10:05:22 -0700 (PDT) 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=JuqKFRyk; 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 S245277AbiDRN7B (ORCPT + 99 others); Mon, 18 Apr 2022 09:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243556AbiDRNeC (ORCPT ); Mon, 18 Apr 2022 09:34:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A502240AA; Mon, 18 Apr 2022 05:58:00 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id C53A4B80E4B; Mon, 18 Apr 2022 12:57:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F85BC385A8; Mon, 18 Apr 2022 12:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286677; bh=4jTFIdE/RLeE76gCMMXu6/RBZIRcmWv8WEiWwMjmKIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JuqKFRykhPqagGT5xnkDmpNnIzAF/XiZOdaZ+8gJbmR7LxYZdBKoz/sHLl5xAeDiP TaUNCQSddWLojtIQqbFt7/xrnOu4NQ2qeAT7y0gNSSmD1O35lCKYYKLAkKeedgS8v3 AI8ND+Oqx8V0StFGvwEFrE/PS8vanaUuCu2qfpdA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Yang Guang , David Yang , Richard Cochran , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 208/284] ptp: replace snprintf with sysfs_emit Date: Mon, 18 Apr 2022 14:13:09 +0200 Message-Id: <20220418121217.635183809@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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,T_SCC_BODY_TEXT_LINE 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 From: Yang Guang [ Upstream commit e2cf07654efb0fd7bbcb475c6f74be7b5755a8fd ] coccinelle report: ./drivers/ptp/ptp_sysfs.c:17:8-16: WARNING: use scnprintf or sprintf ./drivers/ptp/ptp_sysfs.c:390:8-16: WARNING: use scnprintf or sprintf Use sysfs_emit instead of scnprintf or sprintf makes more sense. Reported-by: Zeal Robot Signed-off-by: Yang Guang Signed-off-by: David Yang Acked-by: Richard Cochran Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/ptp/ptp_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c index 48401dfcd999..f97a5eefa2e2 100644 --- a/drivers/ptp/ptp_sysfs.c +++ b/drivers/ptp/ptp_sysfs.c @@ -26,7 +26,7 @@ static ssize_t clock_name_show(struct device *dev, struct device_attribute *attr, char *page) { struct ptp_clock *ptp = dev_get_drvdata(dev); - return snprintf(page, PAGE_SIZE-1, "%s\n", ptp->info->name); + return sysfs_emit(page, "%s\n", ptp->info->name); } static DEVICE_ATTR_RO(clock_name); @@ -240,7 +240,7 @@ static ssize_t ptp_pin_show(struct device *dev, struct device_attribute *attr, mutex_unlock(&ptp->pincfg_mux); - return snprintf(page, PAGE_SIZE, "%u %u\n", func, chan); + return sysfs_emit(page, "%u %u\n", func, chan); } static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr, -- 2.35.1