Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp630863rdb; Thu, 30 Nov 2023 14:01:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGihtJt1DO4exk8mPjxSjxL2Sya+AmAlOEen+NoOak/l/BnNJmC3d0J9jd00g1L9oyoeOu/ X-Received: by 2002:a05:6870:5a8b:b0:1f0:8122:554c with SMTP id dt11-20020a0568705a8b00b001f08122554cmr21038963oab.45.1701381683800; Thu, 30 Nov 2023 14:01:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701381683; cv=none; d=google.com; s=arc-20160816; b=DT4SVvUWxTaLAgfNh+SleOgK5a6huHEjtTg4cRZmMVPQFur5SBueO3+4UUkeo6jqr1 0u79Gzm3ChrSdPqsanhp8OLDHzfaqebql6NSP4wE0ODjw6h7QIKyopLUFDOg5juWLn9n CFGyh4CwAWUTHh2Zx9AvZ4vacBaoBoF3EuAs7zAtl0JrYpCKtAZjZ3g2a5aHgSLL78Zq Nz5gOBOdzBOGt0zokx2vwfqYyCBNblvFiWytRB3XGFyKiVLhPVv4tTo7tnlpfm3gKKkT S1bm1SaPijhSmYIfqnYrN6TDDXRwv6HC0IpDShTSXbtIoHS/+H5TT6KhEyG+KRjfCdoS 7DNQ== 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=3bHceCWW/FNIBqL0qlF7bzPuAbLJU4rZ5dawH7WmBGM=; fh=8Rma7wi/QOTNFhgCK7ekvfIKjXpepHAR4BMjIfV7T8c=; b=FcL2BoLZXv+j/jN/kdm+LcBx8lCL+j7kmbshcQN1lKqsPM7PxwAApexgXrjWAwzpff /4/KrSjpaesZZQKzeaOYAkMbrYKnDamHVP+MoClejl0J0yvBvhcAU1cUcNUmHcabx+5U +y9wOqnU8FbNbYx8D9aPIf/orrUd2iSs7RVdHw3IqEDbYnyLp1F4UDnFBfQXsrbR8HBr So4bNoj8FS/6AHOCKpr67qcxn0/32eghuOKobBNZB4mw6WL4/nH/Qy/PbKyeB95QvbS/ BoxTqR3rB5u2XnsfpEL08ncF5kyYXs5aKCJtg9/TGs6laGb6DSPd6IKqaHm+iJ19TpDr It1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QaHHYymG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id q19-20020a9d7c93000000b006d84a2fd352si778919otn.347.2023.11.30.14.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:01:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QaHHYymG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id BB1DC80EABB7; Thu, 30 Nov 2023 14:01:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377144AbjK3WA5 (ORCPT + 99 others); Thu, 30 Nov 2023 17:00:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377191AbjK3WAp (ORCPT ); Thu, 30 Nov 2023 17:00:45 -0500 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 AE0451718 for ; Thu, 30 Nov 2023 14:00:51 -0800 (PST) Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-58cdc801f69so858562eaf.3 for ; Thu, 30 Nov 2023 14:00:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701381651; x=1701986451; 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=3bHceCWW/FNIBqL0qlF7bzPuAbLJU4rZ5dawH7WmBGM=; b=QaHHYymG5QTpGaPRydqT47f0CStdwRTvS51rLZPUkYmKyZRv/4PTlAuaHvK22CLJLW yuKqnBc1o7tcT2dmNOfbblun6EZMdvzfpinhlnWlfZPhs8n7+4Bz73ZmDzXYQEJGX+LF cAu5oojBgp/MPGvW+QVpdp01+dwEZ9sINSWyk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701381651; x=1701986451; 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=3bHceCWW/FNIBqL0qlF7bzPuAbLJU4rZ5dawH7WmBGM=; b=gqXzRedesbOrmtq4mIa+pZ3UKqKrGziyOMpbSPyj31TyJA+0edVTHVBNb2+x16cFXh CBlcUw44L7754ucYksLtgXFaFZaJrjFKtR35mGavgk5tlHs1XBEZD4xri7RdDvXZZ3z2 EjQdAdDwstGCvJ0gGPcTOAfDlw7MhEH41QHVQJ10UOMO+VA1umll6iN/iJuhdgFl3Vyd 429rDAF9CNXGlhH5O/yXqwnqvOSsJ0HG/s7ZErdy+tjU10HQpIYnbHKns0X+pdvUOk4L 2VPoZhFjiaehcZckKfWcJMiE2IJP2C9UxnJU2mtw4SIF9hn2RPG3DmaDwoUgYlE/YhhO LVTg== X-Gm-Message-State: AOJu0YyiwyWkoCOiYp3xu0tPH/rN7LleCP/s12EDZ9BvfWwUv3DnA5mr eyidWF+aDFCpxb5YGIVexGtMCA== X-Received: by 2002:a05:6358:7206:b0:16b:f555:4c34 with SMTP id h6-20020a056358720600b0016bf5554c34mr29347624rwa.1.1701381650901; Thu, 30 Nov 2023 14:00:50 -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 1-20020a631541000000b0059ce3d1def5sm1748288pgv.45.2023.11.30.14.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:00:50 -0800 (PST) From: Kees Cook To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Justin Stitt Cc: Kees Cook , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Xu Panda Subject: Re: [PATCH v2] drm/modes: replace deprecated strncpy with strscpy_pad Date: Thu, 30 Nov 2023 14:00:40 -0800 Message-Id: <170138163824.3649248.18015700667277399745.b4-ty@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016-strncpy-drivers-gpu-drm-drm_modes-c-v2-1-d0b60686e1c6@google.com> References: <20231016-strncpy-drivers-gpu-drm-drm_modes-c-v2-1-d0b60686e1c6@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Thu, 30 Nov 2023 14:01:20 -0800 (PST) On Mon, 16 Oct 2023 22:38:20 +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 should NUL-pad as there are full struct copies happening in places: > | struct drm_mode_modeinfo umode; > | > | ... > | struct drm_property_blob *blob; > | > | drm_mode_convert_to_umode(&umode, mode); > | blob = drm_property_create_blob(crtc->dev, > | sizeof(umode), &umode); > > [...] Applied to for-next/hardening, thanks! [1/1] drm/modes: replace deprecated strncpy with strscpy_pad https://git.kernel.org/kees/c/d8d273c595db Take care, -- Kees Cook