Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp335372pxb; Wed, 20 Oct 2021 23:56:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvmya7GEFa+zjHL/Mj1IzjmyIv1bl3cqTG4o9yqZdZtY72AZHWSl/k+PmJxqXRcg9F+BJA X-Received: by 2002:a17:906:1707:: with SMTP id c7mr4985488eje.377.1634799412296; Wed, 20 Oct 2021 23:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634799412; cv=none; d=google.com; s=arc-20160816; b=hK3do4xsTWlBvk4tGT6g9zbXogHja9arkI0dE46jixqYe/UOxuV0gF7iGZRxhstEyu fe7u0sACDMHDOO7BxY8icUOVAcla3tNAd7PHRKC3q2h1/VKGyI2VtuiqNPs5dPT6VXLq IB4xvZYvHV+JdxXDR+duB66Weqr/EOfuSRZi/2hgwMuSf22ycJ9u46NMSY0uzAUnfd9q Nqj0enfWqL11vOrkISz0KdqOsRQckyV9gkMpzugsvatIPHnfDZxfZClmoaYzbwtMoT7L rC4k2Gf/ZOqAZbVDQ8++adHJwkIzJ8CWX18cyfzlH9JF4hNP9GfJ8cPe8VSU6UKz7NLT xS0w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=4IT569PC5azMfJUgBeCpQwHxR9xWFaiNqcnPd3IC73s=; b=KoAdXX/J/57UgPpvx+zpb7gTR38KA1jSOlvfZJB1HExA2seFep3+S6ydg9Y1y42ptx +taXZftWKzqNhCybU1LnkoaDaFzP5olMK8rOViGIP/ZZWCM0+cAm8IOZGq653RACFNXA ynsRXXuu18VUOvN4+2HZ/06qfLf1JJ1xaPss/mrucSWfgSiudVL1OvjkVum8PKjs6Cqk Is+ID/DqLMua3/FSPZXQ1mhFO1HeyBFOssrOGYcgWGqNyy+ZshyklR1IpwZLRMQcMEK8 VlLQydZabhEoM/Jl5zsaqeZ3NHa/5F6pkhUZhw6fisTqGUhqmRincsT/R7iX4u3Jz1+1 +lNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q3pSCZDR; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr23si8067973ejc.465.2021.10.20.23.56.28; Wed, 20 Oct 2021 23:56:52 -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=@gmail.com header.s=20210112 header.b=q3pSCZDR; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231278AbhJUGxm (ORCPT + 99 others); Thu, 21 Oct 2021 02:53:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230385AbhJUGxl (ORCPT ); Thu, 21 Oct 2021 02:53:41 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA51FC06161C; Wed, 20 Oct 2021 23:51:22 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id x66so1670858pfx.13; Wed, 20 Oct 2021 23:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4IT569PC5azMfJUgBeCpQwHxR9xWFaiNqcnPd3IC73s=; b=q3pSCZDRL5KRM3nvMGV2JXBH/4b6ox9NxeQKc+0sSfJ777k+A0GZnc86SKVZm8B6FP KiZFZcKa2lKX0xrSbZroAher8ZC35dXlFmyWaFImSw6Bxx7FR/E1+HvowzD0zQ1GtIyM SVjBPAcBWR4c60+CeEGyMTq0P6DQR55mf9MXq9XB6cAy6xTapHI1ybFdwpW58QXaWXJ+ 8h6QidGoNMOJQspJNWmYXM5ZVodysciypEoAfx/zHNfrrvJ83QUgjT8keumD/10XFWiF 8hIr7rVqE30Y4ot56oqV7xAPFqqDaYw7vjWiSq/TgQqNLPSMOoLHICJj0wgsqaBTDPEk JUYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4IT569PC5azMfJUgBeCpQwHxR9xWFaiNqcnPd3IC73s=; b=Fhr5Qus8A6Zc3JwUjoOzn4Py7nA2aABFaGaUmBfm/2ehqP74YQCBnqSnhCMAAJwvpj MUMnqgvUbWIZfir6e1yAMI35yoWkmTkrXHDvK+YUkcxcYivyXzHuGrSysj+u+jK2H9qS WEU8voOnVuKPjin4aX7Kzrf8PT96DTtJxAlQqWtP02t0lHVPY/GyQmLJoQzinfhMcpre +tcN/wgL9zcDylXwB/gletDwHEbjIwldf0Ja4UIHjxaXnnZ2MEucbNeCOy9PlM5iBqgX jPPbUjguMwFW32OGpW1QKRiUjycGB96FyTaOSOXzlqc0u4UyDpO9iDhZWtyqqqN7yDA/ Q3uA== X-Gm-Message-State: AOAM531tO8gv87inYNqgxhGQfrTvs+KMo5x8pojVcBOaTv+m/8wF35HS i5Y1JXNTKbpOI/3KCDSnJFU= X-Received: by 2002:a62:e510:0:b0:44c:e06e:80dd with SMTP id n16-20020a62e510000000b0044ce06e80ddmr3623411pff.48.1634799082315; Wed, 20 Oct 2021 23:51:22 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id r14sm4063254pgn.91.2021.10.20.23.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 23:51:21 -0700 (PDT) From: cgel.zte@gmail.com X-Google-Original-From: ye.guojin@zte.com.cn To: mst@redhat.com Cc: jasowang@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, axboe@kernel.dk, virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Ye Guojin , Zeal Robot Subject: [PATCH] virtio-blk: fixup coccinelle warnings Date: Thu, 21 Oct 2021 06:51:11 +0000 Message-Id: <20211021065111.1047824-1-ye.guojin@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ye Guojin coccicheck complains about the use of snprintf() in sysfs show functions: WARNING use scnprintf or sprintf Use sysfs_emit instead of scnprintf or sprintf makes more sense. Reported-by: Zeal Robot Signed-off-by: Ye Guojin --- drivers/block/virtio_blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 303caf2d17d0..8a71b2f9f4b7 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -624,7 +624,7 @@ cache_type_show(struct device *dev, struct device_attribute *attr, char *buf) u8 writeback = virtblk_get_cache_mode(vblk->vdev); BUG_ON(writeback >= ARRAY_SIZE(virtblk_cache_types)); - return snprintf(buf, 40, "%s\n", virtblk_cache_types[writeback]); + return sysfs_emit(buf, "%s\n", virtblk_cache_types[writeback]); } static DEVICE_ATTR_RW(cache_type); -- 2.25.1