Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp473063rdg; Thu, 12 Oct 2023 10:48:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFmzDRQgNQR+47nmQKkGFIq/ScAdU3NYFZ1rDo5yDapg8nTI35KleIYAKc4wp6JSsYZDSy X-Received: by 2002:a17:902:ab46:b0:1c9:c91d:3fd6 with SMTP id ij6-20020a170902ab4600b001c9c91d3fd6mr6642744plb.5.1697132882312; Thu, 12 Oct 2023 10:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697132882; cv=none; d=google.com; s=arc-20160816; b=K3cfihn0ZxQD4LQ+0BW5/iTgX1xVk7q8rbahz/4THRfesJx0mZEsSnQlGomoaShdEH 2YUeazSqC1PbaOffMW1tSf/ZIwxxnXXo/3vwuJeDDzGt3oL7nEJ5FvSntrA0UbPnGaq/ WKG3u95GJw4FMFIlnDXR4bq8o9PisQ89y0oGvrbTXcYG4uIxmYGGOHd21qWeNhz3ukOY SkFJloEywcb30juH3gnIOP3DIeWddyDzhvEb9KG4qjfF99lWKoR5hM0gl9QdgAeIjHL+ uAWBJLirmrcU3RJNBteP3wpl2+3kQJ/bDtmIM0O0NxlpeqmgbMgr+Wk5on0RQ/vqZStb /gkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=kZ5cBSWgR34rbCxupj7uHLFbP8vjmFBvwRGEvSBQmBE=; fh=zPZTPJdrcivtSZnL/vl/RDbtWoxrQ7Od0kFqLCqAL1A=; b=Q5o9JpD/B59jq2+thoQNGl8lgW1P+wqdG754HdPO7FnuZsJhs2QZFaPEvIyEOhdMPm NDy3pc94/i6kluVNZwDkiCBqCYAqmLZVFt6LQLOHcplBnuILuoPaOo1PylicIvAKW94S ln2ze+OUxn0LXSB0JqX2XJTsqystpcoAbA0Qt7+imno9/hYAxLl36bj4hdKFQBXr0dqr Ty0W8j3ymt3WPxTCFeIFtK9orTguj8qwFoR74qxtkpykuSNTM0WVwcd83dHlnXTs9etQ 7lV8lqIzqYWU+azMNX83qneu+MKRYc2hoHu6kYlUSV6h2dFtL3RQJducx/qQki+mHUvd TMSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WFOkLyN0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k1-20020a170902c40100b001beef8ccd05si3004816plk.489.2023.10.12.10.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:48:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WFOkLyN0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C1085828D002; Thu, 12 Oct 2023 10:47:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379631AbjJLRrh (ORCPT + 99 others); Thu, 12 Oct 2023 13:47:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379549AbjJLRrg (ORCPT ); Thu, 12 Oct 2023 13:47:36 -0400 Received: from mail-oo1-xc30.google.com (mail-oo1-xc30.google.com [IPv6:2607:f8b0:4864:20::c30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 266FFB8 for ; Thu, 12 Oct 2023 10:47:35 -0700 (PDT) Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-57b67c84999so755967eaf.3 for ; Thu, 12 Oct 2023 10:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697132854; x=1697737654; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=kZ5cBSWgR34rbCxupj7uHLFbP8vjmFBvwRGEvSBQmBE=; b=WFOkLyN0ES41s8IdmvELIh+qlzx8O+7h2KZ7RZscB0ouHJOfk0gbVjJx/K/KbBp2u2 xIlLJh+gYMYlELuSgTtEJFw6zyIxfDRj8kt6mrlRneebPydXl4rec/2r86x2p0Bzj3f/ FQ0hJAsXgTvbk/uV2cxpirL6m2ad7CAh2dag4ifGsPJnXn5uJJtuOKx1l+e7Qp5cNchW U2QtJD7ql69AAYuIPv+pV/091zeClnf4vhEtbj+khciu9BgjDgAhtCoeqCiU33seQhuZ dkFIektmsQuYBOn+mZTINl/+OSREmiNO9dnuwWRBm0ISSFhO9ids1LtlwMx9dO2JhoFT y1iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697132854; x=1697737654; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kZ5cBSWgR34rbCxupj7uHLFbP8vjmFBvwRGEvSBQmBE=; b=e6b/BH/WdW/wzBybGJVC+w8q2DUxHOA4zUPIqWQbbaN6XHGpqalDsL6UQ1Fjbh87+V 0R0TQkhZf3SLRTgCtPpE8XwhBqthGO8iM9EgpIQD864klB9QszFyieSqJEk2Qsfm+4D3 y/g0s7uzMoTEq5YdpwWXdVjNeOHZzRkebsOu1CD6sDyitCXhH5zUN47SD4AAwjPvqSCC 6X+xMgcaNKSMTyMtMr3ZWf7Hej9g5H3YsLrQT0sxSTHB2t6JPK5bulJ0c1yDy8x1HQcM Ehl7MbTT6KOCh43fTQkwKxUxKFeXlH7/Ho0GkJzQI3qSNkpGeva6RKjvJx7ennjI+Z4C +cdQ== X-Gm-Message-State: AOJu0Yxt/2A2IglYLbmCOtkTLtj5dJ6vnD3YLV1Unkykq1sZ8fRkeEOk /I8qPpil5dILFG449U0y8jPpl2obfdrFxq0Fk78= X-Received: by 2002:a4a:9b0b:0:b0:57b:6d88:4cb2 with SMTP id a11-20020a4a9b0b000000b0057b6d884cb2mr26109502ook.1.1697132854386; Thu, 12 Oct 2023 10:47:34 -0700 (PDT) MIME-Version: 1.0 References: <2023101234-extenuate-regain-2e36@gregkh> In-Reply-To: <2023101234-extenuate-regain-2e36@gregkh> From: Calvince Otieno Date: Thu, 12 Oct 2023 20:47:23 +0300 Message-ID: Subject: Re: [PATCH v2] staging/wlan-ng: remove strcpy() use in favor of strscpy() To: Greg Kroah-Hartman Cc: outreachy@lists.linux.dev, linux-kernel@vger.kernel.org, Archana , Dan Carpenter , Simon Horman , Bagas Sanjaya , linux-staging@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:47:58 -0700 (PDT) On Thu, Oct 12, 2023 at 7:42=E2=80=AFPM Greg Kroah-Hartman wrote: > > On Thu, Oct 12, 2023 at 05:01:57PM +0300, Calvince Otieno wrote: > > In response to the suggestion by Dan Carpenter on the initial patch, > > this patch provides a correct usage of the strscpy() in place of the > > current strcpy() implementation. > > > > strscpy() copies characters from the source buffer to the destination > > buffer until one of the following conditions is met: > > - null-terminator ('\0') is encountered in the source string. > > - specified maximum length of the destination buffer is reached. > > - source buffer is exhausted. > > Example: > > char dest[11]; > > const char *PRISM2_USB_FWFILE =3D "prism2_ru.fw"; > > strscpy(dest, PRISM2_USB_FWFILE, sizeof(dest)); > > > > In this case, strscpy copies the first 10 characters of src into = dest > > and add a null-terminator. dest will then contain "prism2_ru.f" w= ith > > proper null-termination. > > > > Since the specified length of the dest buffer is not derived from the > > dest buffer itself and rather form plug length (s3plug[i].len), > > replacing strcpy() with strscpy() is a better option because it will > > ensures that the destination string is always properly terminated. > > > > Signed-off-by: Calvince Otieno > > --- > > drivers/staging/wlan-ng/prism2fw.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-= ng/prism2fw.c > > index 5d03b2b9aab4..3ccd11041646 100644 > > --- a/drivers/staging/wlan-ng/prism2fw.c > > +++ b/drivers/staging/wlan-ng/prism2fw.c > > @@ -725,7 +725,7 @@ static int plugimage(struct imgchunk *fchunk, unsig= ned int nfchunks, > > > > if (j =3D=3D -1) { /* plug the filename */ > > memset(dest, 0, s3plug[i].len); > > - strncpy(dest, PRISM2_USB_FWFILE, s3plug[i].len - = 1); > > + strscpy(dest, PRISM2_USB_FWFILE, s3plug[i].len); > > } else { /* plug a PDR */ > > memcpy(dest, &pda->rec[j]->data, s3plug[i].len); > > } > > -- > > 2.34.1 > > > > > > Hi, > > This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him > a patch that has triggered this response. He used to manually respond > to these common problems, but in order to save his sanity (he kept > writing the same thing over and over, yet to different people), I was > created. Hopefully you will not take offence and will fix the problem > in your patch and resubmit it so that it can be accepted into the Linux > kernel tree. > > You are receiving this message because of the following common error(s) > as indicated below: > > - This looks like a new version of a previously submitted patch, but you > did not list below the --- line any changes from the previous version. > Please read the section entitled "The canonical patch format" in the > kernel file, Documentation/process/submitting-patches.rst for what > needs to be done here to properly describe this. > > If you wish to discuss this problem further, or you have questions about > how to resolve this issue, please feel free to respond to this email and > Greg will reply once he has dug out from the pending patches received > from other developers. > > thanks, > > greg k-h's patch email bot Hello Greg, I did amend my first commit I used the command: git commit --amend -v The result of this commit action is what I sent over. --=20 Kind regards, Calvince Otieno