Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp556818lqt; Mon, 18 Mar 2024 16:51:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX4YCoLlYuHqiMrzZ9L35o/aBW+LgZh7RyN0I1Sw2WIp4IIoxhftqqaMTm2U0qQpFuBeTyt0d7rhkoELNAjxDcaEPL/zik6/Lt+2XxGiQ== X-Google-Smtp-Source: AGHT+IGzQtnolm07r+CTytzNNaHcwdnhsprS6rJoA6bN/ZWqXX360kg4TUDT8tEzYLsBX14z+gYT X-Received: by 2002:a9d:6d85:0:b0:6e6:7614:9612 with SMTP id x5-20020a9d6d85000000b006e676149612mr1162424otp.10.1710805915161; Mon, 18 Mar 2024 16:51:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710805915; cv=pass; d=google.com; s=arc-20160816; b=l/VNi1qZ8ff4tbqUKhbVjXv34JrdQFmNwbmJrblADs2RwUma5CXfSxCefHMMv80CG5 pmTrSC1rtd4ChbRsYD5HcRWDGR6qnwwVy06mCKgQf1YrtB/+mPCOo1hQenutx7gcPkd3 Wdhw626OEA2fgG+jT5Yeya3P1074RNdJ8SA+eVR0pysBK/9eqUg7rOcrcVy6+ohy48sB 8ziJmfHjpqMDcmvBhSubIjaZpau4fUgqSF/YtVJQnzUQKy8wBtiG6CsxWNJYn3Q+Y3oM AFKvRD06QWwzAZAwvrKbtgQcFvdpCiO0S1HzKEJ38ytvD8jKrlqbKU7Fl2/i389Qc/nv Mahw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hLMhotFwHtUIj1BzQPggj9DUeFsCq1j3jcfIf9VTyoc=; fh=Uh/VlW4N06SAD1GQ7Q0w0SUPLavaFN97i2OFNMGjcvc=; b=hlR5iwabuqQ7CLhRp/0paQMeslmJCXt+6c6lSI+bajNkQJmPW5Q5TgLQ6lTD6acB07 QEmMEopMqPhFh00RMFvIQYvH+qyDwfn4uJpCHgPGqua4OIgenspmW25CyWDosB0Pllss ITjZompgkYwXfaXBXEU2KSEHzeNnQU/K6g3/UOKj40pNQxfAV073D1i5WX+lZehsKYIi nlrtmDHZRfv0Ls4vWx+AMZnljo4a+6Xdto5tgWf2qZsou7sf5ptBukSmxnzkzV5zuOfK TYCBUjAX/fCHA194vCBZ9y00hu2XYOvazSKEJARW3gHBUzWHzeyOg2MOIB/bQGwRqInQ DQNw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=P8WsICKV; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-106831-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106831-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x10-20020a05620a098a00b00789f94f2fb4si3891970qkx.553.2024.03.18.16.51.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 16:51:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106831-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=P8WsICKV; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-106831-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106831-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DA2501C21909 for ; Mon, 18 Mar 2024 23:51:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 587705F876; Mon, 18 Mar 2024 23:51:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="P8WsICKV" Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B0C55F862 for ; Mon, 18 Mar 2024 23:51:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710805906; cv=none; b=EwUYwC/ATh9A3YYH8ylOs4ds43gGITR8yYSzoXKcpqNcFMchNl+oY9yGqsu8h/QXnAdHLcIErJv22ISP8+aOabkzkx51xhoZivzplq7Tnp3RzogWFPMyKqQTynkiTAbFuwrH+ViT16qaWjHZwvu5Hb1SdMb3wmB4kwiEAQYRhII= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710805906; c=relaxed/simple; bh=dsiON50OCpUxEqQfubPrK6S1drnpo7LDAB6I6guhQwQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rA12/0DiHyvv+cn90TI3pZ4sjs3MvJNcudDdl+hjb87LOoGSWkxT88uPpNmnI5yBajSopNhmGeoXgOr6eXxgBVGgk4DEFT5qTIWQhg7noLVyF/5yHV2sHuyxJHB2moXYHTPiPHZUVuB88eyCntve88CpiqHv/wqvjLd8bkACMK8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=P8WsICKV; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6e6c8823519so4758422b3a.0 for ; Mon, 18 Mar 2024 16:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1710805904; x=1711410704; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=hLMhotFwHtUIj1BzQPggj9DUeFsCq1j3jcfIf9VTyoc=; b=P8WsICKVxlSAz4F8g7dk9sqPnWkmoeUQaGxaE/RcXsq46+RzXY4eNgafJ+Q7Wv2T/g 6iZpsH1bGFjVIQnNJM9wuGrxUmVgg4bCv9aIjy8IVDzC8auTa6jhnhi9pZkAmXJepLMC P2swYLpcOhmmE6QUD8b69i48EwBksI6lhE9C0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710805904; x=1711410704; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hLMhotFwHtUIj1BzQPggj9DUeFsCq1j3jcfIf9VTyoc=; b=rp2Pzs3cAg64eiMlwl3B8SNlBo0u3jEJZyFWWvcvUSCju+yLlPsPWkUWbVRo876opI HO9KWXl11lXxeaP3cvA8TPk60p5t6doawNBNzAkl9UqY+GNw+y/Ht0HCL3DoMWBR0twq /mECrLdPbzFxqb3XVbrWltO5Re+QWwY6S7MXWALrGarDcfmwsfuA9rcP1RWzQBdXGytZ qcpx0xWSjsLq0EQcOvlktvre7BhAoQ6QfppO60JvzqJux86OYhRVDlZ2GsV/YULjigeA PPIWhv4Mh+AWbphWnAgKBaFdKBqq1b2nYcOQg4U7eWGJTNSET/HUCe/6tdIjIH0E1/nP AYcA== X-Forwarded-Encrypted: i=1; AJvYcCWFTj2E1ri+Q+zikDO+FxRuAjP7UNXRO7D52fcFRNNnowY3Zamwjy0fw/bniSRNWnJSvcIJ2oAkHMTsP9uPUpQ2IgbZx7aknqPYLjhi X-Gm-Message-State: AOJu0Yxc3ugsE/vtBAgcAm20YAMJkFOk+rukPzNE2GzDjw5fPiwiux2z 8Wo9IVdJcAmrp+vd84yqUk1OYWv/0crH+uMZs+DC2RPUlRQKm0p8Z1PaoIvDOw== X-Received: by 2002:a05:6a00:a23:b0:6e6:7abd:b870 with SMTP id p35-20020a056a000a2300b006e67abdb870mr1687932pfh.12.1710805904517; Mon, 18 Mar 2024 16:51:44 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id ks25-20020a056a004b9900b006e6f2251898sm7190594pfb.0.2024.03.18.16.51.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 16:51:43 -0700 (PDT) Date: Mon, 18 Mar 2024 16:51:43 -0700 From: Kees Cook To: Justin Stitt Cc: Bjorn Andersson , Konrad Dybcio , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] soc: qcom: cmd-db: replace deprecated strncpy with strtomem Message-ID: <202403181651.8F755705A@keescook> References: <20240318-strncpy-drivers-soc-qcom-cmd-db-c-v2-1-8f6ebf1bd891@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240318-strncpy-drivers-soc-qcom-cmd-db-c-v2-1-8f6ebf1bd891@google.com> On Mon, Mar 18, 2024 at 10:49:23PM +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. > > @query is already marked as __nonstring and doesn't need to be > NUL-terminated. Since @id is a string, we can use the self-describing > string API strtomem(). > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Justin Stitt Nice! A textbook use for strtomem(). :) Reviewed-by: Kees Cook -- Kees Cook