Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1495318pxb; Thu, 7 Oct 2021 08:52:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwd0iWJwwT0qze6XbWIG3+WX2TMf+xtD78a/kmI25Y0r5EyW2j4r2CbimbPJwHkM722D4BR X-Received: by 2002:a17:906:38c8:: with SMTP id r8mr6692066ejd.172.1633621963042; Thu, 07 Oct 2021 08:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633621963; cv=none; d=google.com; s=arc-20160816; b=PAOHmh0vYlAMN7Zh2Q8yNsmMAvdNQM4U35ohUzrjwvg0R7aE2K1z9YIJ4j8rECPJrO IZoOB717YurDaUVci25Srjw98C8M59Sb6mF5CQbxCg2D/C3i5IFtGFtlwTpI1gqKKcws vUaFgj2z52LSa0m64/V21NXH+2vaGsF57ScbInN8gHInNg1QLGWngE/e8C1IGoquYxtv utZ1NK64YE7Xzru5zqATplsL3608X47xKmDjlzhDjS/iLMYxksSaAeimI4AIWtoG5u0m H0lDLk3WP1MWsKwiwyn80x6LPvClDGYnx+ZNl178RJkAL3E81cBz6m/9MszemJEvDDji RytQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XzU6oWjvmOHgCKTPrKN0uGNh1889uFEZ8Tg39EoSLKM=; b=gFB/3x1acZHiMCkMvn0D8d6/jrQp8dRz7ffdaEovEeuKVYaDuWbJ+IczJId6jyaKFC tZ2fV7NXYDuh14wzghfmhhdctAY480EZhnBOAR/BJcJvIuMs2z+ww3msugfaIeKKLbLq ordSPyYUZ6rJD7NeNmnFxJwWtd6OLCh74m0cS1oAdzgVGGmNVLOpsIm7tmm9DredImc0 PZgnrgF6HvF6ylfWw6FUeYwwsSKwO8xevFbHr6R7UqUzP2pPZ6C+pMJZcboNNMoNbWGU +7DBf8Q0afO1V2MHn6nNqsef1lMHNzAgiEQI2iYyUqznt00Lc4M7i3if0bBiNyMZCklf zRoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JCEpDS3K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di18si3576622edb.289.2021.10.07.08.52.17; Thu, 07 Oct 2021 08:52:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JCEpDS3K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S242166AbhJGOyO (ORCPT + 99 others); Thu, 7 Oct 2021 10:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233341AbhJGOyM (ORCPT ); Thu, 7 Oct 2021 10:54:12 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BCF8C061570 for ; Thu, 7 Oct 2021 07:52:18 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id q19so5076869pfl.4 for ; Thu, 07 Oct 2021 07:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=XzU6oWjvmOHgCKTPrKN0uGNh1889uFEZ8Tg39EoSLKM=; b=JCEpDS3KTeXpR8Z/rZUHez8x3bbvKmt/de9LG9aO7vvj1JDE9LdN50zKW3tC9Cdtvo t1ioptpTk0zh1bdqaGOshS9+hMna0KS/z2RkSiaRDOivGX33cppYPs8kOpjFtU/M/Aet wzxH5vkr1tslrTinXtn9k0rODukyqSeDSX9Vg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=XzU6oWjvmOHgCKTPrKN0uGNh1889uFEZ8Tg39EoSLKM=; b=3auOxv6C92c//TawKheLCONghUZevRR7e+pf1O/+q0Wxharw8/tFh8IaoAfI13O7zD du6l/yTUpyjJ6ZSzfy1iowFp4hIZ7bDTnC2SRI3tqybhFLjksDTX8LHw7pKgMm95J08v rhILtLzUeuyW2IXpDKtjf53ANMtT5otfCW3G3w6sNfx/D/VxPk8c9smGlQPwWkiHs0Z/ pS2IrhOA+HDIteKV9YRxaybfAk/HyEguUJvCCu0U8mrKNA2vlvO/7OtHsXOUtnyVy1dv Zf8IG6Drcqh4Q78CdQs/QGM12VzkvKPootIvhGFXHgbWmWscIMv5i/1l7VgVzoiHUTrw CG2w== X-Gm-Message-State: AOAM531iK8c49GUej0t1LlpkTHUU6+k+hTOHSMCn2EIUETX6eQC2XQ/e 1FWx6xAs0bp3KXLS4F7hlMy0Jw== X-Received: by 2002:a65:6919:: with SMTP id s25mr103960pgq.14.1633618337790; Thu, 07 Oct 2021 07:52:17 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id mu7sm1062709pjb.12.2021.10.07.07.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 07:52:17 -0700 (PDT) Date: Thu, 7 Oct 2021 07:52:16 -0700 From: Kees Cook To: Yafang Shao Cc: pmladek@suse.com, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, peterz@infradead.org, valentin.schneider@arm.com, mathieu.desnoyers@efficios.com, qiang.zhang@windriver.com, robdclark@chromium.org, christian@brauner.io, dietmar.eggemann@arm.com, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/4] fs/exec: use strscpy instead of strlcpy in __set_task_comm Message-ID: <202110070751.929BA101@keescook> References: <20211007120752.5195-1-laoar.shao@gmail.com> <20211007120752.5195-3-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211007120752.5195-3-laoar.shao@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 07, 2021 at 12:07:50PM +0000, Yafang Shao wrote: > Fix a warning by checkpatch - > WARNING: Prefer strscpy over strlcpy - see: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ > > Signed-off-by: Yafang Shao > Cc: Kees Cook > Cc: Al Viro > Cc: Petr Mladek Acked-by: Kees Cook > --- > fs/exec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/exec.c b/fs/exec.c > index a098c133d8d7..de804c566200 100644 > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -1224,7 +1224,7 @@ void __set_task_comm(struct task_struct *tsk, const char *buf, bool exec) > { > task_lock(tsk); > trace_task_rename(tsk, buf); > - strlcpy(tsk->comm, buf, sizeof(tsk->comm)); > + strscpy(tsk->comm, buf, sizeof(tsk->comm)); > task_unlock(tsk); > perf_event_comm(tsk, exec); > } > -- > 2.18.2 > -- Kees Cook