Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp281976rwb; Mon, 26 Sep 2022 12:16:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QQARhJp3FbPcdgJxlHjGT6ShVB/K5Vj/7VZWaL35b72+ufnnl296sI5g+V2vpY+leE+gi X-Received: by 2002:a05:6402:28b1:b0:456:c333:b7dd with SMTP id eg49-20020a05640228b100b00456c333b7ddmr18581827edb.205.1664219789557; Mon, 26 Sep 2022 12:16:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664219789; cv=none; d=google.com; s=arc-20160816; b=pUKYSLQNoz5xTXAUBWPnW8U7IWZ+teHeDYMrhznGqwYkUvKza9GbbXDiPEnMI0wal+ 99sZ9nGN7bgXhRTDVleL/64Uwby5LQZMIoY8ugEpTq0FhCOFcs6V4HDx7sRYy6toaiP2 77unTv9Ec+wgJDgiiXqfPK+moD0hTd/AvDlT2dqN1GKt0GGgxkKrK92/YbRWNDAuFg4E 99lcg3o03bC3bUsxL/9C0cHrNNdRz4d2JVSZ3Wbwp6Dw1Beo9B/ag+1m98I/Br0dGqV1 4B55jXcX6OscML/bQ65sgv/1VF7p02T9rBwkIgvY3xxrF+zMC/8s15RecQrAvKTzsP4I SHSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=YWy5dAY8OXlfZakbmyL3MvfrEAJ3U12lMsLHLwd72I4=; b=p3oa/vnEop6L1+CElcywYTPvRLvaPElcybvf/J+bx30bGTGJfApnRfamfkUHJTYOb+ 7tBX8DS54gFXci/p/ntjD/E5lnXranreEUj6wUeXoPSbCz7FC+IegEYr7QnbaXv469QZ QYhMy5cG6HlLTQZg/IZMmGq9fj7ysRFP2aXNYb5+TUkssvQra0GoUWgLdnsQXX6OqlHt NbeDbtMTwbUKSTXWJwCYYm/gfCB5tgYPO8FgONX6R7a6enltfEk9nY10PB71GwY73qDZ pyELMwpLcabDa9s7CKqz3oWpEo0J80unN1BLeHjAVKmnISlAk0pck4EBgAPcgYs7lw4a Lccg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ENjZRdx6; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id au16-20020a170907093000b0078309fc9477si602432ejc.439.2022.09.26.12.15.58; Mon, 26 Sep 2022 12:16:29 -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=@gmail.com header.s=20210112 header.b=ENjZRdx6; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229913AbiIZShn (ORCPT + 99 others); Mon, 26 Sep 2022 14:37:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbiIZShl (ORCPT ); Mon, 26 Sep 2022 14:37:41 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C440D659C4 for ; Mon, 26 Sep 2022 11:37:40 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id z13-20020a7bc7cd000000b003b5054c6f9bso7529264wmk.2 for ; Mon, 26 Sep 2022 11:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date; bh=YWy5dAY8OXlfZakbmyL3MvfrEAJ3U12lMsLHLwd72I4=; b=ENjZRdx60Y14KVIfgiPpREzXHjTXmOeJhqMOPGD2GzO7iXZ70LsyxiMMOkiRnU+BDb 9VzlSqYZqmP++9MRjWoeInjXa7y5p9M3A0uL1hp/B22vwV3JKII4zSCr6Vg+vCY1MBi+ rJmOLHswgfen5auuQIFJ8Vncn8nwcBjqcFLNvMRcTs8vCJu2AD90OAgc1N3TbiW5HrFQ VPvUugRXQKewQQtBeLABfuHWY26EKFP9i9vYx9FmlbcJEUdUjxyRGUAE1nBJzGUGL+WK E2x5DhybML/zlPvG+st790WcOPte9+6/TbuqlNimV1328g29AJAMKpRZSdKQJyKPj1J7 ogzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=YWy5dAY8OXlfZakbmyL3MvfrEAJ3U12lMsLHLwd72I4=; b=J3qKWFDN3+VoSevwt37iZrL9IBixG5MeYY9HjzzbndgFGt3z60fosypVmg0f8FObFt f9uGmoaUmpZNdlZzQakWHtAVX7bdSLlYrwMAueGzZJm4rRmsbF3hSOJ1t/89eDI1wEQs qk/PD25uDGf+a/7weVYiRdpLtp0tD2Oj/E/Pk58yfrL5/JLC6OMMI+lUvloU9Zti0RqR 63PPUYpsfGnVTH5yeNyKxpv0Qc/scO4sn/GCh6D8cp2OtNTI5FwwxJhNHQ1QQ64CWQvP JNZK0XWHZxj89CxvV2hetWsUn4jwX32dYhF7evgKPnG9Es5OCf90GWCEaGg1ulekH/B7 BNMQ== X-Gm-Message-State: ACrzQf38d9HTlIgw478/+dAIZCGTPFJ0Zv7CM7NUPbeb8bWla/72Qn4j nqiz8avMZcWEqMnLIjqYUQ== X-Received: by 2002:a05:600c:3511:b0:3b4:bb85:f1e3 with SMTP id h17-20020a05600c351100b003b4bb85f1e3mr86616wmq.0.1664217459201; Mon, 26 Sep 2022 11:37:39 -0700 (PDT) Received: from fedora (88-106-97-87.dynamic.dsl.as9105.com. [88.106.97.87]) by smtp.gmail.com with ESMTPSA id m10-20020a05600c3b0a00b003b47b913901sm26341385wms.1.2022.09.26.11.37.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 11:37:38 -0700 (PDT) Date: Mon, 26 Sep 2022 19:37:37 +0100 From: Jules Irenge To: abbotti@mev.co.uk Cc: hsweeten@visionengravers.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, abbotti@mev.co.uk Subject: [PATCH 1/7] comedi: Convert snprintf() to scnprintf() Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Coccinnelle reports a warning Warning: Use scnprintf or sprintf Adding to that, there has been a slow migration from snprintf to scnprintf. This LWN article explains the rationale for this change https: //lwn.net/Articles/69419/ Ie. snprintf() returns what *would* be the resulting length, while scnprintf() returns the actual length. Signed-off-by: Jules Irenge --- drivers/comedi/comedi_fops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/comedi/comedi_fops.c b/drivers/comedi/comedi_fops.c index 55a0cae04b8d..e8a0142d5894 100644 --- a/drivers/comedi/comedi_fops.c +++ b/drivers/comedi/comedi_fops.c @@ -396,7 +396,7 @@ static ssize_t max_read_buffer_kb_show(struct device *csdev, mutex_unlock(&dev->mutex); comedi_dev_put(dev); - return snprintf(buf, PAGE_SIZE, "%u\n", size); + return scnprintf(buf, PAGE_SIZE, "%u\n", size); } static ssize_t max_read_buffer_kb_store(struct device *csdev, @@ -452,7 +452,7 @@ static ssize_t read_buffer_kb_show(struct device *csdev, mutex_unlock(&dev->mutex); comedi_dev_put(dev); - return snprintf(buf, PAGE_SIZE, "%u\n", size); + return scnprintf(buf, PAGE_SIZE, "%u\n", size); } static ssize_t read_buffer_kb_store(struct device *csdev, @@ -509,7 +509,7 @@ static ssize_t max_write_buffer_kb_show(struct device *csdev, mutex_unlock(&dev->mutex); comedi_dev_put(dev); - return snprintf(buf, PAGE_SIZE, "%u\n", size); + return scnprintf(buf, PAGE_SIZE, "%u\n", size); } static ssize_t max_write_buffer_kb_store(struct device *csdev, @@ -565,7 +565,7 @@ static ssize_t write_buffer_kb_show(struct device *csdev, mutex_unlock(&dev->mutex); comedi_dev_put(dev); - return snprintf(buf, PAGE_SIZE, "%u\n", size); + return scnprintf(buf, PAGE_SIZE, "%u\n", size); } static ssize_t write_buffer_kb_store(struct device *csdev, -- 2.37.3