Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp192608rdg; Thu, 12 Oct 2023 02:57:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQaPaA6bdqcupWCti5dOYvYEejW7mrznl77UTH5cz0fZt72BcVKslcxTfgfEV024V5qeHQ X-Received: by 2002:a05:6358:998e:b0:13c:dd43:f741 with SMTP id j14-20020a056358998e00b0013cdd43f741mr16537388rwb.24.1697104656957; Thu, 12 Oct 2023 02:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697104656; cv=none; d=google.com; s=arc-20160816; b=AZd9ReCUouIqAuIwuP2kuJdPjlIW7sH2OstOgZrpuxBQYEYO1kML+mh+8yWFRRSawm MB3VANaksgWCammieELwh4Lk/QFlkE/Ef851MXJViu8CZhTfIFKrWsgjhgZjkIgvMPg9 4dCQG+CwjkYcllYXkERmebjvnZgFp54y/hSEAvqGCEBKnDwZAKbTlACLVhpu/jIYDi7N LcT5A+0Q6MvMArEtYKV+gJ8ooRy5MSkvi1ZAIoaIxULbPgynu0EFJcOfu7np9tHKqudG Vm+jy9OcBHQd2zzdPADdvG3OFit33DQOFudmRdxJ3Vk3CPvVVxJDFWK2nWIMS5sAmYZ8 VWNQ== 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=WwdR5UfKZdkaWRIAkpPnNZMh5uS4lp1PwggWWgtXHKw=; fh=M6M837E1WBQ4oF4WBjrZtIHzia68O3/igDM0CiUwS4w=; b=S5mmuPidp4Bpqf/59iln/cE0weU07yVxL9jKbaeDM84wV3BBqmj+2nspSJkYSErZV7 ptpitYCpRMXHMZEZqaPZDH32PfdQjOJ1+DpsC8W2vLjIAB+jmG+pLVNxyBHslQ7isUsp 6s1WgUtAeP2qzvq9R1QXCswfHKSWI0V8nl1/u4bYaTxoa+kf2/35C6GN9D7kIYNsPXdm sABATZQ65OZnap1qFbIjO5dzDWmh/p0pIJfj6kU2ItPp+Wo7w1G7D+bz3u25t9oe+O97 Xha0Sw4vaqnZ7XVEg/+Pk12tvd11uMqH8sxhzmqd1CcRpX4n4/G6cfQCuV8O4UJdfCPJ Lj+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mbDcQa5p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z41-20020a056a001da900b0068fcf6fe22csi14143032pfw.304.2023.10.12.02.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 02:57:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mbDcQa5p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id D4A258218E41; Thu, 12 Oct 2023 02:57:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234177AbjJLJ5e (ORCPT + 99 others); Thu, 12 Oct 2023 05:57:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229757AbjJLJ5d (ORCPT ); Thu, 12 Oct 2023 05:57:33 -0400 Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC02D9D for ; Thu, 12 Oct 2023 02:57:31 -0700 (PDT) Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-57bb6a2481fso399838eaf.1 for ; Thu, 12 Oct 2023 02:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697104651; x=1697709451; 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=WwdR5UfKZdkaWRIAkpPnNZMh5uS4lp1PwggWWgtXHKw=; b=mbDcQa5pbAaSeFPk/14Q5/a5dstosnaFlrMaENvP5wcB4S8S/5Se15eL8Hq46RDqfL SG9ipX6PWjBFBOUNQWaD9GG5TnxfinI9Z9tQOZB/S4dD7+5CvCetjCZjO4PjKXUAAC9D H+GvW1O5ZjppOvXcoFroi77Vw5m0sMVXKF/VfmJD8KZvEh3/slE7/WTa0P/8ygDSm8bb q3deCzDhciMX6uLFkFbDwavCQtQJZO43ZGLsoHOIOoT8KUT1ZL7nBWNof6G186SqqRza kGNQefR33rD+bWxvWL+a51nElk78azeD9IImhKCHnYNZpgJL713jcNAYqIqDfeeMJlj0 XnDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697104651; x=1697709451; 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=WwdR5UfKZdkaWRIAkpPnNZMh5uS4lp1PwggWWgtXHKw=; b=ZSN42TKMuU8LMV7bm4F/caMePKz1QofQPOoQOwvBms27h/mBo9iqkS7OTuy/Z4YIBZ +TwqjvEr3n4TRI+lIpWFzTFnstdhj4Fdu4DklnVe34ALmKkGPVpcV+Qu/HERjExTUx7/ nTcvhnPF/0bv0H0HuFZU2FmCuSxbRrPTEiutlIinkZegZRlokrqZ1p4kKr9ppiRuHptL HsOBpr8Vm462WI4gzNKXJxDrrf+iQ2jGp8KdiqYqcbzywk809U/OyGIfQgp1k3JeKUFy pHWZy+Kr6fn8xWUp/4Vo3EwYmbOWAKeqRZ1f9z02dJkWOSa8CwlTTMt7kuuIgr4Y7Hkk Z41w== X-Gm-Message-State: AOJu0Ywo6Sjsx7JXYPimZzJUcv7xXDEEON5CIUhXlqReDW/HJP29ksS2 PRlGo6mwmvmy2t1AwUFiG3GXB7n++nuu9wg8GghLfrexP1RYPxiY X-Received: by 2002:a4a:301c:0:b0:56c:dce3:ce89 with SMTP id q28-20020a4a301c000000b0056cdce3ce89mr22961387oof.5.1697104651071; Thu, 12 Oct 2023 02:57:31 -0700 (PDT) MIME-Version: 1.0 References: <1e2cfefb-c4dd-4611-867a-2b2e9e5f7467@gmail.com> In-Reply-To: <1e2cfefb-c4dd-4611-867a-2b2e9e5f7467@gmail.com> From: Calvince Otieno Date: Thu, 12 Oct 2023 12:57:19 +0300 Message-ID: Subject: Re: [PATCH] staging/wlan-ng: remove strcpy() use in favor of strscpy() To: Bagas Sanjaya Cc: outreachy@lists.linux.dev, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Dan Carpenter , Archana , Simon Horman , linux-staging@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_BLOCKED,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 lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 02:57:36 -0700 (PDT) Yes, strscpy() has the same behavior as strncpy(). It is preferred to strncpy() since it always returns a valid string, and doesn't unnecessarily force the tail of the destination buffer to be zeroed. On Thu, Oct 12, 2023 at 12:17=E2=80=AFPM Bagas Sanjaya wrote: > > On 12/10/2023 12:27, Calvince Otieno wrote: > > 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 - = 1); > > Is this strscpy() behavior same as previous strncpy()? > > -- > An old man doll... just what I always wanted! - Clara >