Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1033218rwe; Wed, 24 Aug 2022 13:36:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR4xmlAYl4JNQ8KJBVYKzKzRKxTq1D9MKB+kl6jqnuihLMoMBosDAu8hcSlBOrWNp5UI7Ajw X-Received: by 2002:a05:6402:2029:b0:447:aae3:4fa3 with SMTP id ay9-20020a056402202900b00447aae34fa3mr455702edb.104.1661373391194; Wed, 24 Aug 2022 13:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661373391; cv=none; d=google.com; s=arc-20160816; b=CxdkHnAK1vJR+utVypfw9tsqkL2oSNDlCNUUPSete1Ly2abC+DXQqaRYv/gBbOe7Jo SuYKGHrqePl/tpUYoPVf08Z23Uvgo/3Urke7ReiuF/RcXh6W20oCJbKLmjG00knv2pIS cdzbqysLR6ncK50c6qxVXaCb2V/Os5V4CDmlC4kx30BkxMX84NzTt3301bUj4OdgO3oZ acGBBPoZ73CXGWpYSM85DyJk//pNyYahpKF4Dk2pesQYrA3BGggzvQrLIGCy1mB9dX+s biCCjo9vyY9K/Ka+oCj7S3cm351znyXNnKHeD3TrO7xqD3Sjt3BuveJtK8dxccS2oiPA xVhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=0BGLeIeywCEJ3dCddcIl7kkPKUm3a3EcT3lVsS2hi5Q=; b=K2zNX0yILy+FWH51IiPivnTBkVKCkkgzh/ISdcR3fTc2KW5Xfuzezd2Kkhus3AaF03 VFNLgQsuonZ4mTkh9sqmqULS8SaZWYUNbjGwxCwKBDUe7jwbBZwBexIhvDF/M5ZOEGyI 5l91cXbyZs0sFx7Ggb+e2sxYMVhFL80Oo9GkYauu5pYr19bVt8VvEMrvs1qVtE3IJuqO JodcphP4KM95xqkflsbrD0/jpYrTGG/zVPjRXxSe72a/oPGEsJtAbCxPaD7E1Xphl3oW YBWckhcQq9G/wjtEwwbae+A/2RyJpfQOKfyHkQHkEpi0PvXbH47pEYX8MWimiz1fBwzS 5X9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=Q+De1sSt; 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 hb43-20020a170907162b00b0073da90f1998si2802281ejc.943.2022.08.24.13.36.05; Wed, 24 Aug 2022 13:36:31 -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=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=Q+De1sSt; 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 S239057AbiHXUIo (ORCPT + 99 others); Wed, 24 Aug 2022 16:08:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbiHXUIl (ORCPT ); Wed, 24 Aug 2022 16:08:41 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4B307C192 for ; Wed, 24 Aug 2022 13:08:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=k1; bh=cGo8IqrG/KMEITictY7c3nGCM3fN 8IhhTVEah6GE6VI=; b=Q+De1sStZ3EMtn0rk0NMKRhepZ0v1mmx+EIFS1Dan3Zo fHV8fjTU5Gmbana/BPunGB4IUkyu3HKhb2PRimrsnFXDeOXa9T/uavq/uDl3IKDQ HOS8biVFgncyIhY1PF6oRqTMd/Of3AnAQzoOuA7F6WhP6M0IwRDp7zlWzgzVwBo= Received: (qmail 2367966 invoked from network); 24 Aug 2022 22:08:39 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 24 Aug 2022 22:08:39 +0200 X-UD-Smtp-Session: l3s3148p1@f20gPwLnwIcgAwDtxwoDABxA2q3xYuRb Date: Wed, 24 Aug 2022 22:08:38 +0200 From: Wolfram Sang To: Andrew Price Cc: cluster-devel@redhat.com, linux-kernel@vger.kernel.org, Andreas Gruenbacher , Bob Peterson Subject: Re: [Cluster-devel] [PATCH] gfs2: move from strlcpy with unused retval to strscpy Message-ID: Mail-Followup-To: Wolfram Sang , Andrew Price , cluster-devel@redhat.com, linux-kernel@vger.kernel.org, Andreas Gruenbacher , Bob Peterson References: <20220818210144.7915-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4Tos7O8I/5EpltQ3" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 --4Tos7O8I/5EpltQ3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Andy. > > - strlcpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN); > > - strlcpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN); > > + strscpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN); > > + strscpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN); >=20 > Perhaps the size should be changed to GFS2_LOCKNAME_LEN to match the size= of > the destination, too. >=20 > With that addition, this patch fixes this syzkaller report: >=20 > https://listman.redhat.com/archives/cluster-devel/2022-August/022755.html Linus wrote another summary about strlcpy vs. strscpy use[1]. So, the size argument should be the size of the smaller buffer if the buffers are of different size. GFS2_LOCKNAME_LEN is smaller, so that looks suitable. Shall I resend the patch with the suggested change? All the best, Wolfram [1] https://lore.kernel.org/lkml/CAHk-=3Dwi+xbVq++uqW9YgWpHjyBHNB8a-xad+Xp2= 3-B+eodLCEA@mail.gmail.com/ --4Tos7O8I/5EpltQ3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmMGhUYACgkQFA3kzBSg KbZFCw//Uv87sZJFYRzCSSRxchAgtLlyCFwPcJBZHh6W85/umoJN6WDBWqcUS8IN +vCugF8lo2gUkBvQxfltmEP39oVI9aDdNSz+d5OPt1vCBfkRu5JMAa/jUQxHEGzm vmmILcol1Zr+GYbbcDu3qxV44EPoHdvMjLzJ2FEZP5ODIy/zDNIsLxtdSupjR1ut YsWH6LT5i9jZrrC+PpHecxGC3wU9dIsGcxgwhpR9Mz3/M0YwxU3DQb4hMAIEh3Yg yedUz71kLZqjC9nuXbVZnfhwEOolDXgt6j6wdkM0F5/TL6et6a4pPUaO6U560FgM SeORpAYWbLAizkdS+2/LrebOG3ZSGhyi1O1ty735J40RuE9XzP+fmmyN9D5MdmOe PYundwj3LbDy5CK7jRPd/AV36Wu0Z8c/zThZoTmTSL0e0S3ZWp2oxNpwwBVJGZWd LJ/teDfKB0fj1IoG3MdiurtU5S5Dk8Z83ahNcthWINeL183JSTeA7qw3FiawTXiP u2xQ5hq9nenUBy7F0S5MU1nyQrnGpraLzpY/UVEAeW1McZ6K/IAYB6O5hV30O7Cg aup1oQEmIYM65/jHU0fgj1yBi39luLF/RQ0JKL5nV3YnAXZPyYVZWPaSyVb8C+xt 69QAaFnB/+rITWKMTlUURgPfSZ3xyp928Pg5lKOo0ogtFNA25FE= =LSxC -----END PGP SIGNATURE----- --4Tos7O8I/5EpltQ3--