Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5235297rwp; Sun, 16 Jul 2023 23:38:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlH3ucySLxhkRjsHz7OfnDKQyVpbnkADMo0x6N9RLBonHpHG1f7RVAnCRDQigq8PAXHQufvp X-Received: by 2002:a05:6a00:1a0b:b0:67e:5edd:e6e7 with SMTP id g11-20020a056a001a0b00b0067e5edde6e7mr11330673pfv.9.1689575931268; Sun, 16 Jul 2023 23:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689575931; cv=none; d=google.com; s=arc-20160816; b=sZbmaY7NNqjJBcI3ZrhlEZY0MxnWkHpyfI3hO+G5PHLOrm1HNAP7P7TagEDjyUEvKH F8NpX17kJV8sXBx6l5fGzs7OauRbg9p0RKS5H+zGnsK1jmOVrXndlBXkDj/NZ/ZF3L+t 3engpHjtYOLiYrr/wTX2Kar0TkGYa0BEF57uCBYkMC0kzBlY1YPZ2npjoWuRIvyuQtz4 IHcCczQg+dXpXwwhk8F8D5fgmVKmRuHsMzRSCLZrAUFaOf394Wx/SSx/jIeXvLA81M+f +cDK5IK2r65Q2sDITlKyk9Y4+LAGzMEkuiboxky9J3ig5YZfxgoO0bymUk8tSw7Ccmsw lkig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version :dkim-signature; bh=HiT943TZujyBtP2hxz0rKTAUnNp2nri05cxiaDD9KLU=; fh=FZY8AuhUF14GAl4i51HNyKXYHQK9aDnwBeZ+jzJSxD8=; b=dVRWUEPOlpkAfP7b3btTyfPaKvn9PHaBEJhTlkewH6DmRmdtkS7tPYlfxDYzthkfqM BIzX7KO8cjxRsFI5PRKjxPpURmEfD8/aGEI7ydWjvDLDaKsl1wDs68TjrtEjLtqpI+/q FWCY9xoqLZ8Rc/EZfkSp5Wi7/lXsVu3k3m4DpWk0jl710S/cPL+WUcE7plKnEH0ArrH2 ctx0hxOUql4eojNFXje2O6h2JUuZ3K512V8bZSNqc6GYBf9ggVFd2bIHsZPOIsW52/l/ q4q3YmCTI73sH40JACbftjxPO6MobsmIFd4gGYc5g6DgxV3GYWiYW46t3gq9u/EhvyCn UFiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (bad version) header.i=@208.org header.s=dkim header.b=f9PBpLEv; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h2-20020a635302000000b0055c79b73043si6075641pgb.769.2023.07.16.23.38.39; Sun, 16 Jul 2023 23:38:51 -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=neutral (bad version) header.i=@208.org header.s=dkim header.b=f9PBpLEv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231461AbjGQGSi (ORCPT + 99 others); Mon, 17 Jul 2023 02:18:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231419AbjGQGSh (ORCPT ); Mon, 17 Jul 2023 02:18:37 -0400 Received: from mail.208.org (unknown [183.242.55.162]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C22B11C for ; Sun, 16 Jul 2023 23:18:34 -0700 (PDT) Received: from mail.208.org (email.208.org [127.0.0.1]) by mail.208.org (Postfix) with ESMTP id 4R4BjN0YWszBHXhQ for ; Mon, 17 Jul 2023 14:18:32 +0800 (CST) Authentication-Results: mail.208.org (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=208.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=208.org; h= content-transfer-encoding:content-type:message-id:user-agent :references:in-reply-to:subject:to:from:date:mime-version; s= dkim; t=1689574711; x=1692166712; bh=oVZePtAPC3fqwCLp67FFuqYQqHm SMXChT2dSFjfiNgM=; b=f9PBpLEvFF7pj+m6iqfzgDlO3V/jRhRjBUq1Dq9GwYS XJoNGRaUF9qsMFa4xW8yJxmlXKL8/r78EbpCBKefbaO1/goTWHL6Q+mXXlai1ydK gYewFrmxyw5LOSh1WmtgGXCvimlyp7Sq23cFMDS4EH8JdgP2R4D/pA4zJFxtkYjg nSngh3Y6dSp7CRbXq+tFKs0LxZzeJqNOpTDVSan9maacuyZdR2aovIG6aUV6Ewga vI10r+jYK9WuhYTTWWkc7ijOU7WZNAW/gH0AEZCppyn4AC0MQ71YfncORN3zNNat mhBExsW0JzEF3E8UMIXHvieDt0dzMlcLN/imLwO6edw== X-Virus-Scanned: amavisd-new at mail.208.org Received: from mail.208.org ([127.0.0.1]) by mail.208.org (mail.208.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id okXOQfCU0eD8 for ; Mon, 17 Jul 2023 14:18:31 +0800 (CST) Received: from localhost (email.208.org [127.0.0.1]) by mail.208.org (Postfix) with ESMTPSA id 4R4BjM5btfzBHXgf; Mon, 17 Jul 2023 14:18:31 +0800 (CST) MIME-Version: 1.0 Date: Mon, 17 Jul 2023 14:18:31 +0800 From: hanyu001@208suo.com To: jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: qla4xxx: Convert snprintf to scnprintf In-Reply-To: References: User-Agent: Roundcube Webmail Message-ID: <4a69897245577acfb2f095501b21cd78@208suo.com> X-Sender: hanyu001@208suo.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_BLOCKED,RDNS_NONE,SPF_HELO_FAIL,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 Fix the following coccicheck warnings: ./drivers/scsi/qla4xxx/ql4_attr.c:200:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:273:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:281:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:303:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:210:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:264:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:312:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:159:9-17: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:256:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:247:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:181:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:190:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:223:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:235:8-16: WARNING: use scnprintf or sprintf ./drivers/scsi/qla4xxx/ql4_attr.c:173:8-16: WARNING: use scnprintf or sprintf Signed-off-by: ztt <1549089851@qq.com> --- drivers/scsi/qla4xxx/ql4_attr.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/qla4xxx/ql4_attr.c b/drivers/scsi/qla4xxx/ql4_attr.c index abfa6ef60480..6ab578443e12 100644 --- a/drivers/scsi/qla4xxx/ql4_attr.c +++ b/drivers/scsi/qla4xxx/ql4_attr.c @@ -156,7 +156,7 @@ qla4xxx_fw_version_show(struct device *dev, struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); if (is_qla80XX(ha)) - return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n", + return scnprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n", ha->fw_info.fw_major, ha->fw_info.fw_minor, ha->fw_info.fw_patch, ha->fw_info.fw_build); else @@ -170,7 +170,7 @@ qla4xxx_serial_num_show(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); - return snprintf(buf, PAGE_SIZE, "%s\n", ha->serial_number); + return scnprintf(buf, PAGE_SIZE, "%s\n", ha->serial_number); } static ssize_t @@ -178,7 +178,7 @@ qla4xxx_iscsi_version_show(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); - return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fw_info.iscsi_major, + return scnprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fw_info.iscsi_major, ha->fw_info.iscsi_minor); } @@ -187,7 +187,7 @@ qla4xxx_optrom_version_show(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); - return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n", + return scnprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n", ha->fw_info.bootload_major, ha->fw_info.bootload_minor, ha->fw_info.bootload_patch, ha->fw_info.bootload_build); } @@ -197,7 +197,7 @@ qla4xxx_board_id_show(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); - return snprintf(buf, PAGE_SIZE, "0x%08X\n", ha->board_id); + return scnprintf(buf, PAGE_SIZE, "0x%08X\n", ha->board_id); } static ssize_t @@ -207,7 +207,7 @@ qla4xxx_fw_state_show(struct device *dev, struct device_attribute *attr, struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); qla4xxx_get_firmware_state(ha); - return snprintf(buf, PAGE_SIZE, "0x%08X%8X\n", ha->firmware_state, + return scnprintf(buf, PAGE_SIZE, "0x%08X%8X\n", ha->firmware_state, ha->addl_fw_state); } @@ -220,7 +220,7 @@ qla4xxx_phy_port_cnt_show(struct device *dev, struct device_attribute *attr, if (is_qla40XX(ha)) return -ENOSYS; - return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_cnt); + return scnprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_cnt); } static ssize_t @@ -232,7 +232,7 @@ qla4xxx_phy_port_num_show(struct device *dev, struct device_attribute *attr, if (is_qla40XX(ha)) return -ENOSYS; - return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_num); + return scnprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_num); } static ssize_t @@ -244,7 +244,7 @@ qla4xxx_iscsi_func_cnt_show(struct device *dev, struct device_attribute *attr, if (is_qla40XX(ha)) return -ENOSYS; - return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->iscsi_pci_func_cnt); + return scnprintf(buf, PAGE_SIZE, "0x%04X\n", ha->iscsi_pci_func_cnt); } static ssize_t @@ -253,7 +253,7 @@ qla4xxx_hba_model_show(struct device *dev, struct device_attribute *attr, { struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); - return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_name); + return scnprintf(buf, PAGE_SIZE, "%s\n", ha->model_name); } static ssize_t @@ -261,7 +261,7 @@ qla4xxx_fw_timestamp_show(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); - return snprintf(buf, PAGE_SIZE, "%s %s\n", ha->fw_info.fw_build_date, + return scnprintf(buf, PAGE_SIZE, "%s %s\n", ha->fw_info.fw_build_date, ha->fw_info.fw_build_time); } @@ -270,7 +270,7 @@ qla4xxx_fw_build_user_show(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); - return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.fw_build_user); + return scnprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.fw_build_user); } static ssize_t @@ -278,7 +278,7 @@ qla4xxx_fw_ext_timestamp_show(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); - return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.extended_timestamp); + return scnprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.extended_timestamp); } static ssize_t @@ -300,7 +300,7 @@ qla4xxx_fw_load_src_show(struct device *dev, struct device_attribute *attr, break; } - return snprintf(buf, PAGE_SIZE, "%s\n", load_src); + return scnprintf(buf, PAGE_SIZE, "%s\n", load_src); } static ssize_t @@ -309,7 +309,7 @@ qla4xxx_fw_uptime_show(struct device *dev, struct device_attribute *attr, { struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); qla4xxx_about_firmware(ha); - return snprintf(buf, PAGE_SIZE, "%u.%u secs\n", ha->fw_uptime_secs, + return scnprintf(buf, PAGE_SIZE, "%u.%u secs\n", ha->fw_uptime_secs, ha->fw_uptime_msecs); }