From patchwork Wed Jul 7 08:17:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 12362023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,MIME_NO_TEXT, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4741BC07E95 for ; Wed, 7 Jul 2021 08:13:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23B5B61C73 for ; Wed, 7 Jul 2021 08:13:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230495AbhGGIPl (ORCPT ); Wed, 7 Jul 2021 04:15:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230476AbhGGIPk (ORCPT ); Wed, 7 Jul 2021 04:15:40 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F1BDC061574 for ; Wed, 7 Jul 2021 01:13:01 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id p9so1070421pjl.3 for ; Wed, 07 Jul 2021 01:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:mime-version; bh=sjgK7L6d5P3m0zl1xoh1UTZsSaRzX8OSjGH3nQtYfAk=; b=Qgc+D+1ROrTZMoTPa+Ti4HYAh2q/Jn0Fkh7ECXlowiNBQQQ3QYje9NWA7mgVxv+W0B HH34hO4YDAcGjVHox5PlpWryrQugrVNSqVCjk5oTE77vPf8sR7D7jhKjmE4eSunKJck4 UYobJ1oe7ouDtwYxHkkthJiMiqe3nuvTzPgyA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=sjgK7L6d5P3m0zl1xoh1UTZsSaRzX8OSjGH3nQtYfAk=; b=cH3OknxbEsuz7GMTDbZkStycj5shKpx4+XNAQ3wGFEN4bxzwf1wK8Mc1PitIGwHnJ3 sWQx9BT1wGG5vkvgVRd/28Umh6n88noURK6aw+k8whnOVrHgF95lJt0N6vzn/9m0XJ+P 44CAE2wUtK0u9TSplWNjBVF5fIeSsce18VWlXciZEX6qiVJLQzS1uOs+0K3OnP4udcE5 tlKS8Jk4+3ynfy18ibHSsph0B2bCU+udCDW39VDflQ1ZAraZXX0YLfOk3fBYPnWgJ01k fH18JxtgwqIoxTMKY53rurqhb8H3W1J+2H/d40S8lGMcQbfvNtWKAXVEreFDzd76Rean 16vw== X-Gm-Message-State: AOAM530j/5UcGT9FJPwGqFdoiUevD/qJtUcAa950YMHR1c5B0VneO1Pb uMAno006wadTp6gpdzLaloNmUkrytvOOZxtwcpbfFl5Gs7Ug27LT95OiycvxTRkD5emqAT6b3XL yWl0Tc8o4fdZB5yroPnG+bqW5nbLACEs5nrAl9zgFoisi22qe8CUGwmO39OyMoqCW98qEYFJciV rNYNJx+jhKlrTkwg== X-Google-Smtp-Source: ABdhPJwC2XD6esY7KRdhnU3mSHjpJ4aY32CKKwkeLEZe/nYk5SYaSnhiPUstEkTL8W9B5OiFA8c55Q== X-Received: by 2002:a17:90a:c288:: with SMTP id f8mr8915411pjt.194.1625645580087; Wed, 07 Jul 2021 01:13:00 -0700 (PDT) Received: from dhcp-10-123-20-36.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 123sm464867pfw.33.2021.07.07.01.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 01:12:59 -0700 (PDT) From: Sreekanth Reddy To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com Cc: jejb@linux.ibm.com, mpi3mr-linuxdrv.pdl@broadcom.com, kashyap.desai@broadcom.com, sathya.prakash@broadcom.com, Sreekanth Reddy , kernel test robot Subject: [PATCH v3] mpi3mr: Fix W=1 compilation warnings Date: Wed, 7 Jul 2021 13:47:56 +0530 Message-Id: <20210707081756.20922-1-sreekanth.reddy@broadcom.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Fix for below W=1 compilation warning, 'strncpy' output may be truncated copying 16 bytes from a string of length 64 Reported-by: kernel test robot Signed-off-by: Sreekanth Reddy --- v3: - strscpy() itself will add NULL terminator, so no need to add NULL terminator again. - Also replace strncpy() with strscpy() in subsequent lines. v2: Replace memcpy() with strscpy() drivers/scsi/mpi3mr/mpi3mr_fw.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index 9eceafca59bc..2dba2b0af166 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -2607,14 +2607,13 @@ static int mpi3mr_issue_iocinit(struct mpi3mr_ioc *mrioc) goto out; } drv_info->information_length = cpu_to_le32(data_len); - strncpy(drv_info->driver_signature, "Broadcom", sizeof(drv_info->driver_signature)); - strncpy(drv_info->os_name, utsname()->sysname, sizeof(drv_info->os_name)); - drv_info->os_name[sizeof(drv_info->os_name) - 1] = 0; - strncpy(drv_info->os_version, utsname()->release, sizeof(drv_info->os_version)); - drv_info->os_version[sizeof(drv_info->os_version) - 1] = 0; - strncpy(drv_info->driver_name, MPI3MR_DRIVER_NAME, sizeof(drv_info->driver_name)); - strncpy(drv_info->driver_version, MPI3MR_DRIVER_VERSION, sizeof(drv_info->driver_version)); - strncpy(drv_info->driver_release_date, MPI3MR_DRIVER_RELDATE, sizeof(drv_info->driver_release_date)); + strscpy(drv_info->driver_signature, "Broadcom", sizeof(drv_info->driver_signature)); + strscpy(drv_info->os_name, utsname()->sysname, sizeof(drv_info->os_name)); + strscpy(drv_info->os_version, utsname()->release, sizeof(drv_info->os_version)); + strscpy(drv_info->driver_name, MPI3MR_DRIVER_NAME, sizeof(drv_info->driver_name)); + strscpy(drv_info->driver_version, MPI3MR_DRIVER_VERSION, sizeof(drv_info->driver_version)); + strscpy(drv_info->driver_release_date, MPI3MR_DRIVER_RELDATE, + sizeof(drv_info->driver_release_date)); drv_info->driver_capabilities = 0; memcpy((u8 *)&mrioc->driver_info, (u8 *)drv_info, sizeof(mrioc->driver_info));