Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6113392rwd; Wed, 24 May 2023 10:54:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5862Sz3Mu5u0YUPn8XJ413mVhWcVegCAs5u1VMT0FNoZKqq4Eb9Mccpclo9TD7h9qlYld6 X-Received: by 2002:a17:90a:de0d:b0:255:7a60:bce6 with SMTP id m13-20020a17090ade0d00b002557a60bce6mr8607066pjv.40.1684950895634; Wed, 24 May 2023 10:54:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684950895; cv=none; d=google.com; s=arc-20160816; b=xzF9uDM0cyoTS1IRjTEWsL3XELQxZTkZRDALpPQpj0MoRKRnMba0QkZ3KDtjB9/ztU 05fGNxecRk/Xh7aD+DNNnKNVCK2h4MhhK0EvZlhJhr9WFVyzyjjsFBqwp7Xqt7SmgDiv BbkUl6tOsTU121MxLL9QAPoPv2y8N5gGRyXCWFsdGUY+TqqKh1NdBb4/e5zpXl+Jzllc 3IvWzTU9QJzFyN5xnUygZCUIE2VXsZXeERjU13tFtRYjB/mUfhVWEGe7oEIv4oUMG+FO veiXhVbcA6bfkqgiD9uYhBz8Q/Tc3Gj7hwLpvESk+94s5cP1HaDdnYvVyn2FWO+qc4ms Gfyg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WUCMd7nAkdTG9RTCxIujSC2FhmjjnNJeOfZn/CMRpwQ=; b=XIOLafpAG2USCFpVCM5YcJmEMaZYQtb3P9dyaynE7j1ZyHiU+krwXwjDHLUCxRUKvi vqLizhzASTTLOLE4nxUf7yG+W9NAa25xYnEJgZjo2e9yzb2NVBHXP+z76gem/Wwrlbao NVXSk6RvkRx8J0bK+JoMMeobjtxPp/y8RH7srGAHdOwmJ2ZXBx4amaQ/LLBKF71nChA/ BbQ6kND8GEhzWGwdZPu/kzK1e/1E0Ww6b//bmrZBz64u1TZT+2Gl6lLQEgr4zKE/xpT+ /l6+zM7Trz7HzFfYth2ghhmYDX0RNLlwG/AClpocNl1JcxnWgI9ZFFu6RA8dgwkoNt4P 3FcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=humYlhGm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb1-20020a17090b35c100b0024664356ef7si1794629pjb.152.2023.05.24.10.54.42; Wed, 24 May 2023 10:54:55 -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=pass header.i=@lunn.ch header.s=20171124 header.b=humYlhGm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235779AbjEXRo4 (ORCPT + 99 others); Wed, 24 May 2023 13:44:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235540AbjEXRoy (ORCPT ); Wed, 24 May 2023 13:44:54 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75C84E72; Wed, 24 May 2023 10:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=WUCMd7nAkdTG9RTCxIujSC2FhmjjnNJeOfZn/CMRpwQ=; b=hu mYlhGm6fmZKdKqUq3Bi1K4cY2SDCzaQ1PpXviPNN1fsQYuGbX4YgxnwoxPSQLNWDY7XWGKBjwTv2J oxX+URnxMXC3wpyePSX8hTWwNgsxYjDN/e+ZpIQsC9HDzm4LPlFmiYYapX3DyPlHRr9s1H3hvB3HS NUgGHTtmFKjl840=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1q1sVz-00Dosl-9s; Wed, 24 May 2023 19:43:11 +0200 Date: Wed, 24 May 2023 19:43:11 +0200 From: Andrew Lunn To: Kenny Ho Cc: Marc Dionne , Kenny Ho , David Howells , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-afs@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Remove hardcoded static string length Message-ID: <5b1355b8-17f7-49c8-b7b5-3d9ecdb146ce@lunn.ch> References: <20230523223944.691076-1-Kenny.Ho@amd.com> <01936d68-85d3-4d20-9beb-27ff9f62d826@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Wed, May 24, 2023 at 01:02:36PM -0400, Kenny Ho wrote: > On Wed, May 24, 2023 at 12:02 PM Andrew Lunn wrote: > > So the compiler warning/error needs to be fixed a different want. > > Understood. Would caping the length at iov_len with a ternary be sufficient? The quoted text said 'string'. It is not clear if that means c-string, with a trailing \0. If you just cap iov_len you could end up with a string which is not terminated. The other end of the socket should not blow up, because that would be an obvious DOS or buffer overwrite attack vector. So you need to decide, do you want to expose such issues and see if anything does actually blow up, or do you want to do a bit more work and correctly terminate the string when capped? Andrew