Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp456040lqh; Thu, 28 Mar 2024 07:05:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8oVHlV7UxNxWTjEXug3pETyPiuqJ+s19raFrJR0kJfN3DIweudgTHfDj0F0o05BuviHxXE89LUaNjCdCrXI+BmGIh5KMZ/D+avOEqPw== X-Google-Smtp-Source: AGHT+IEBLzmxF3eXRck23Z/GHdIBzUpobs7BOlhlBuzZoyf7PkZhyR5hWdedgo3U+reP+HWPqMuk X-Received: by 2002:ad4:4709:0:b0:696:98c6:bffc with SMTP id qb9-20020ad44709000000b0069698c6bffcmr2493772qvb.36.1711634754740; Thu, 28 Mar 2024 07:05:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711634754; cv=pass; d=google.com; s=arc-20160816; b=rKpo68Fscml4YKAB5MiPjh8UhG7RvpmtY1MJPh/c+rU6OXoSFulda0gRxjtzKWaHwM m5vM1e7Z01v8zpEvpwPsqbG7P+r80aioITj5F/UzwsHyrOADo3rdfY+axyFbPu/XxnNX DogB7g2qvaahjL6tFMHxcuxG+6QvyCp7/FU/oSm6rlAGwCmXgqN+Uj8/d1mqLAgbIptR jh9X+97ijH9eoLPo3wMyW/R0jYv9tos9rJ5xy1fcKI5/oWqxROSYIdrT2KyCXplKvBXi NbL5FnG0ju4rurkUN1MH0KQqU999ywZEvGGtYNK6psyCVxVOnJKr+NsJrn4mJOFQsoEj AWuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9gzLZfd+JMjIzL6/RDjFi3VNpKKHaIqnTRI+4eVsZds=; fh=akjuJ4fq6iXk2m84jhu1fuZwvn/EgbnmtqEnMiVFoKM=; b=LQRAH3y5qFpE60XSwXu9tzAGW0zA4oxDfWz56KgIG/Gd6wt24bS7xhIL1mSZV9FeAD LEqzGcvcKdJfYjoZ3YaF/SC3AmgQ/rzNF46qBsL2fOiW6ice95U4Kmew1UGDyPLTjYYB kCZS2nz2DZ/HvfTMgX0dNhNopH3t9YwrXwpb5YSu5rBSYtoC2tJ2EwHLpVWZv0PMSbD4 BWRqqqfFZYqR1on8HFgYkykwz/YH77At8etET4cXROiC7CNNSBMIH4ob1d8dJQKxLhbG iXVJrUgm+4ECtpy5YLL/yv6NaDWvEv0NHm1xhTsi8F6IJJe6SpN/qWQ1jD3Vld8zfyV3 Szig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PS5rxxdm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123015-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id da49-20020a05620a363100b0078a00267a7esi1446037qkb.482.2024.03.28.07.05.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 07:05:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PS5rxxdm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123015-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 58C111C289D6 for ; Thu, 28 Mar 2024 14:05:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D58D1823A8; Thu, 28 Mar 2024 14:05:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PS5rxxdm" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A7318120F; Thu, 28 Mar 2024 14:05:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711634740; cv=none; b=JkAPNt7yoZ68jUJXSV+6YcItnIecuQSbG1IfghltNXQwoslFsNall28iUXHLIfM9/mVBNv3GiQkrogjBaVBI62AxHO4SupyhU5E+ACIVI9vfS4QdiXBdPpz+h0aX9oxfHFBmOulsIvR+TvY3Dihkasvde7VkB0pXcQm6xBKxVoE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711634740; c=relaxed/simple; bh=KQvW4QLqr7rEMfi/hFQOWFcSE+Lk/YdZwM/sAdZU8Ec=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UEASRvB40k7cGGe4rXIlhI8LSjeH1i/fpzMuY/cuJr3nRMtY4MZe6aiDLTLPQdXVL4LOzPlFIZlnHFL1q3CrM9hfvdMICPD/SPaVRWaTsDMyzqNpLW8bWdoRpByOnF42KyLbB1r49L5Jc8B3fg9siSwubIgsT9YpQD/k4EA6JvI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PS5rxxdm; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBFD5C43394; Thu, 28 Mar 2024 14:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711634739; bh=KQvW4QLqr7rEMfi/hFQOWFcSE+Lk/YdZwM/sAdZU8Ec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PS5rxxdmgygAFwMhA8Fqr1RY9HLrIBrzNT+eF5P1RzqAVY16HCcGTOFiOFllAb59v S9nizxhkPHCJYGBUcaZRpH+G4RDp9ALws5aboUqudsDYMPwLgQWp3TWxokC6vfnSBU uj5/np5TsbsyZQsQDSHFwZWOxEXxyG5Tus5znIq3DYIzxP3kRBJ21xyZaZPHoGP9x0 x/Vq23EqqFMhVLzX9xaYQo0nO6EVC6A2ZdRI54IRrEBK70XXOOGsIAGSKqy4wszunR cGBLYiJMaEGr3FK2J/Y4iHw/ynBlZKwr8bSo46fWlWT6UiG9qovFBkGKTOYDTHFr2T e7w3Z9MmUZSHw== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Florian Fainelli , Greg Kroah-Hartman Cc: Arnd Bergmann , Broadcom internal kernel review list , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev Subject: [PATCH 01/11] staging: vc04_services: changen strncpy() to strscpy_pad() Date: Thu, 28 Mar 2024 15:04:45 +0100 Message-Id: <20240328140512.4148825-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328140512.4148825-1-arnd@kernel.org> References: <20240328140512.4148825-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnd Bergmann gcc-14 warns about this strncpy() that results in a non-terminated string for an overflow: In file included from include/linux/string.h:369, from drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:20: In function 'strncpy', inlined from 'create_component' at drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:940:2: include/linux/fortify-string.h:108:33: error: '__builtin_strncpy' specified bound 128 equals destination size [-Werror=stringop-truncation] Change it to strscpy_pad(), which produces a properly terminated and zero-padded string. Signed-off-by: Arnd Bergmann --- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 258aa0e37f55..6ca5797aeae5 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -937,8 +937,8 @@ static int create_component(struct vchiq_mmal_instance *instance, /* build component create message */ m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; m.u.component_create.client_component = component->client_component; - strncpy(m.u.component_create.name, name, - sizeof(m.u.component_create.name)); + strscpy_pad(m.u.component_create.name, name, + sizeof(m.u.component_create.name)); ret = send_synchronous_mmal_msg(instance, &m, sizeof(m.u.component_create), -- 2.39.2