Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp631322rdb; Thu, 30 Nov 2023 14:01:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IF27TCioLk/P+wXf1KgdI0EstdLsUqssmP1z17lAf4qBZQVSltshWUSlHI9pAb0PkIuO/bV X-Received: by 2002:a05:6a00:2d20:b0:6cd:fba0:9de8 with SMTP id fa32-20020a056a002d2000b006cdfba09de8mr851486pfb.26.1701381717438; Thu, 30 Nov 2023 14:01:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701381717; cv=none; d=google.com; s=arc-20160816; b=HdgJJPLG7DIoz3Xx4/Y8fZjUD5ZMAesFsh4VBYPuQN0FphQsht2NlEXn134/Xu4ibx WdNmyipU7kNhRMVfKmGLPbaANvi3qCKN9R1XYOhDJ3iE8O1IGt1V3PMv4qbOi0tyrSYO Zh55+ytI2g6VIuFCcCZd6NzDSROgLiiKXPyWxZ17pGd+k6fPoP8f3wYc3pM7qvCaaNms /xIOBcM4Ah85QbdSy+znS8GCj0+z9lnsWz2cCk2NTcgqu5nDRYPAH8DRnMc+nPhuqrGo fhZlEVm04k2B/ApA3QnLoemB05lWwKLYDOl9RZfzCjiupE1mMA3+igg/W6+bay7h/nar +xCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9dVg37Ua/Fw8B4HenbavCwGuNNfMvZwQLsawmvgiFEY=; fh=LOADa+olpatLfV7uZGYlyyx57c955KvUBsQDgA22fMU=; b=FLxBOT+D8ULgFkLs3z90E42jKzca3JHTlsIhBymdPAXN6KU6M1C0gzL0ZCJ3x6dZX3 MGdBbiL3Qh5+RKrOKFQtPabD6ErhprVkMxHvRUxGWgziTg4N08fr6fhuQy9bzBCjMHfh eeK1VSah0ehPdGpuaK6XOg3jY2xmPdrhcsagSRDP54fPAYFU7iD/OXh1m6XLKWLYpDyh cA4qS6RcB6F376eP1GanDx7yzDvV/gJ+MLfExqCG3SWntppQfXAFJOkjv42ZnJBhrWpk +AMgTqlkcRdblN+Tr6p0q1jtly+OtQ99z31TbkyKn24KtjAKBoeaWNc9ZEbI6HEmW5jJ Sk4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JaAtaLET; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bn4-20020a056a02030400b005898d648224si2507608pgb.12.2023.11.30.14.01.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:01:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JaAtaLET; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B26E9804E688; Thu, 30 Nov 2023 14:01:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377160AbjK3WBA (ORCPT + 99 others); Thu, 30 Nov 2023 17:01:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377109AbjK3WAw (ORCPT ); Thu, 30 Nov 2023 17:00:52 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FEAD1704 for ; Thu, 30 Nov 2023 14:00:59 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2865742e256so71777a91.0 for ; Thu, 30 Nov 2023 14:00:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701381658; x=1701986458; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9dVg37Ua/Fw8B4HenbavCwGuNNfMvZwQLsawmvgiFEY=; b=JaAtaLETeFPcZfLusfg+sVJzpWLsuAnHiF2ftTLldOgh8PGm1K+jcKT7qD5jL23Y5b lFbljIXPc6G3TpAFhop5eyrzmfyYPp4xnxP7X/ZX43azb5/DUv7TnUN6MZ65uO0wYhzT whchbSeKkeXB3Bwdloc3VENkPE13cmHm8ggdM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701381658; x=1701986458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9dVg37Ua/Fw8B4HenbavCwGuNNfMvZwQLsawmvgiFEY=; b=BaZ3CSYijh7TQUr8F3Y7IgRdmbhEI3kk2xvIM8zdaNpBq6Hc65zrhltICQIk1RJSLi KF5Vf5WV44PS/cRQbkDSKBbcOQ4Q5JSZahE+3RB8g51Lhf7qpszjtb8A/PVidE19vUbQ gGpsMy18tAM89FojB2uMswHbHRW53SQncmpHJILnoLo5W9kKF6OVVsCJWwx/0QwQyLFz EtN0Ab0fYl6m9sh0+feCKpvZE70Dio2TMVvhSI6gJ5Ozyis+PRxKjLRQW/nqAxbWtu7K mSSud6FRrRMBGjq3vES3umJ90KKwWDryW8EznSVeS0yUw74mI/p+hP2Zd9/v+E6oBiyg 27dw== X-Gm-Message-State: AOJu0Yxki+EJtBPIpdiJ8dfcTzYuRwWa7BcSNabimX6IWd1CZJbtnT2R yfvToHZ3LPw8+ADL9QZesyy5KQ== X-Received: by 2002:a17:90a:717:b0:280:2840:80bd with SMTP id l23-20020a17090a071700b00280284080bdmr20463973pjl.49.1701381658572; Thu, 30 Nov 2023 14:00:58 -0800 (PST) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id qe16-20020a17090b4f9000b002864ab4dfffsm895373pjb.11.2023.11.30.14.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:00:58 -0800 (PST) From: Kees Cook To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Justin Stitt Cc: Kees Cook , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] nvme-fabrics: replace deprecated strncpy with strscpy Date: Thu, 30 Nov 2023 14:00:54 -0800 Message-Id: <170138165207.3649333.12518532307083460238.b4-ty@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018-strncpy-drivers-nvme-host-fabrics-c-v1-1-b6677df40a35@google.com> References: <20231018-strncpy-drivers-nvme-host-fabrics-c-v1-1-b6677df40a35@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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, 30 Nov 2023 14:01:15 -0800 (PST) On Wed, 18 Oct 2023 22:48:49 +0000, Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We expect both data->subsysnqn and data->hostnqn to be NUL-terminated > based on their usage with format specifier ("%s"): > fabrics.c: > 322: dev_err(ctrl->device, > 323: "%s, subsysnqn \"%s\"\n", > 324: inv_data, data->subsysnqn); > ... > 349: dev_err(ctrl->device, > 350: "Connect for subsystem %s is not allowed, hostnqn: %s\n", > 351: data->subsysnqn, data->hostnqn); > > [...] Applied to for-next/hardening, thanks! [1/1] nvme-fabrics: replace deprecated strncpy with strscpy https://git.kernel.org/kees/c/5ef935fd5520 Take care, -- Kees Cook