Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3404075rwd; Mon, 22 May 2023 13:14:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Gp7X9fWrPf5z7htoQXujAOhtcwxq9u5qcV0mytlcyY8t+mF5RCQx198SWAHlyeGqk94dI X-Received: by 2002:a05:6a20:9f8e:b0:103:8c8b:c689 with SMTP id mm14-20020a056a209f8e00b001038c8bc689mr11413152pzb.51.1684786494397; Mon, 22 May 2023 13:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684786494; cv=none; d=google.com; s=arc-20160816; b=jvqFaw2fgniyvwtqC2ajd774WljTTRktTngd71z4aF3d3Z+9d/nrgCtcdbE8JNVsFL Sd+hM40QvupP8ZvwTZMjxg8hkL+/blmbE4MgMM7Nsye29ccoX/VfLE6/eZ3aV27uh8xe 1wUP8Ua1SwohNI1GTWsZfvV2Ec53+lD3vpqqvI7Q4GCa9VaCkI3zJQdYiWafL8wN8zpC h7d8M05hxhY8tRNnsBXsknDHr+lJcvXAiweE9cZS2r7DJQOjiAiAviVkqoZQkMt4PPCq 5OUpteNqnTpwHlYnY4Wu4KQIbe9UXg9TNbqme74twvo+64dfl5tVpTOkU1jO5MZxtZ2g xGZw== 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=jNAaP6+XJai6xtjlcDTjy2E1GXqny00MK+4AdCDW8Kw=; b=QMm3b4SrkxTzzqJE4zat+cTJkJ6MeIzrrAD5iX/26XswoBcBWFgXRtZBmdmS5Gcy1p Hd++JRrJhm1prpIPGvs7rVgKLtjE9Q7va0BzRBv7jJJQPABYH6C5c3rVbcg0RFNbKBZZ 2zhe2OyMNVM4vST1UpNWjkOol1BGkdkS+C/t4lUi3Jd61clml0g5vWhHOSkqXNm86fs/ DkFfvfJc0fRdk5y/jMbeOYSf+4YfbPVcbtx6ZXcAVPLx7VZQAWUiCG5dxSnyvZ9OXGqs gkhjiH8WwmQVS7i2l5f+LFIZwGKOw/Npnv/I6XGS+GEn3MXw0QaP4tbB3UAIbE+A+Dqy NDCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=L917DgUI; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r20-20020a6560d4000000b00524ecf898a2si4962145pgv.359.2023.05.22.13.14.39; Mon, 22 May 2023 13:14:54 -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=@chromium.org header.s=google header.b=L917DgUI; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235215AbjEVTk0 (ORCPT + 99 others); Mon, 22 May 2023 15:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235188AbjEVTkB (ORCPT ); Mon, 22 May 2023 15:40:01 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4F2A186 for ; Mon, 22 May 2023 12:39:55 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2533b600d35so5953224a91.1 for ; Mon, 22 May 2023 12:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684784395; x=1687376395; 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=jNAaP6+XJai6xtjlcDTjy2E1GXqny00MK+4AdCDW8Kw=; b=L917DgUI1lUgyek9XbVU7o1OIweneUJxrl1fmG22A4R2N0dOuIlkd7t+ZPQR8y3Z82 4CFs4eiLChIkj9Edpopu1tfqfUswK3sOMN4/42tY8ztMEjG9PbtEDrOUs98Y5fRCsIKb FXECO0GZe+kqBr0kQLe7f7j2ldk4ljgK735w0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684784395; x=1687376395; 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=jNAaP6+XJai6xtjlcDTjy2E1GXqny00MK+4AdCDW8Kw=; b=dGuVGGiq14ZTqnek5MyKBxpZ2mWFjf3ITEM9WSkjKPCuY90F2olvNryNNS0H7AD9Gj sCIGvvd0b0ziRXHcNwR1cULfI1c/JwsFon+3zdejDgjyduiK1NP1EQOuXHrINbxPmFkM Jux2wfTen/WOJjba+yjZo1ICl3wq6GpaXY6G9rvsinShN4wntgr5ZfT+AGq/9R2ykSyH ZrKtbqRRPhW8akeFpYu8reffc4ZRjwNZ7Gpj4zvPmEpTg7ngYvhOrlfg9c3OC/vKzn45 vYl6KuaxGmVLAzSRmKpU2bfGo7mZtUCTanZNUw+vCDEOY4HXbYlo72sm4Y8fk5AZ99WK 3VIg== X-Gm-Message-State: AC+VfDwO2DZpkV2zCKdBEf51eqRepH6ppbU5Klsctg/GphC+TWkO7KnL wh2XjWol3QDdKrOW5pLH5Y1NtvrU3Uj7RU4JRp8= X-Received: by 2002:a17:90a:70ce:b0:255:4f4c:368 with SMTP id a14-20020a17090a70ce00b002554f4c0368mr5138998pjm.27.1684784390970; Mon, 22 May 2023 12:39:50 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id r13-20020a17090a940d00b0025352448ba9sm6234829pjo.0.2023.05.22.12.39.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 12:39:49 -0700 (PDT) From: Kees Cook To: azeemshaikh38@gmail.com, tyreld@linux.ibm.com Cc: Kees Cook , mpe@ellerman.id.au, linux-scsi@vger.kernel.org, martin.petersen@oracle.com, christophe.leroy@csgroup.eu, npiggin@gmail.com, linux-kernel@vger.kernel.org, jejb@linux.ibm.com, linux-hardening@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH] scsi: ibmvscsi: Replace all non-returning strlcpy with strscpy Date: Mon, 22 May 2023 12:39:40 -0700 Message-Id: <168478437624.244538.16463667694387498508.b4-ty@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230517143409.1520298-1-azeemshaikh38@gmail.com> References: <20230517143409.1520298-1-azeemshaikh38@gmail.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_NONE, SPF_HELO_NONE,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, 17 May 2023 14:34:09 +0000, Azeem Shaikh wrote: > strlcpy() reads the entire source buffer first. > This read may exceed the destination size limit. > This is both inefficient and can lead to linear read > overflows if a source string is not NUL-terminated [1]. > In an effort to remove strlcpy() completely [2], replace > strlcpy() here with strscpy(). > No return values were used, so direct replacement is safe. > > [...] Applied to for-next/hardening, thanks! [1/1] scsi: ibmvscsi: Replace all non-returning strlcpy with strscpy https://git.kernel.org/kees/c/015f6618194e -- Kees Cook