From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 3369A15E5BB for ; Mon, 17 Aug 2026 14:23:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786976640; cv=none; b=YaNbPvE2b2c5MHASnfhAOv4gmo74XynhioRIq/1opZo+ugWq5HQLpWz8GQdz/Xw/bxkRNK/t2TIIcGZTQbnfw+QetVe8KKkz2rwaI1V+owsNHdJhd0EB5zmT9GbwjbrOL7PxK5Gs9ZJbYlJTCxssyvEYEW/Ajkbtwk9c7vLpCbI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786976640; c=relaxed/simple; bh=7aCtA1t/7lG+zje4vmScEV4L0FB8oukORLmRNeadYNc=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AgboPbPmqi6jKxQMX8ijphrYilPdvceoJFQ3ktfZqM6evXY3K2UIujGt0oQeXYZauW6TOB9RSoWlO0TF4FwvBaA1wSl3dgxQmC6yvYEFmLXsxbtcKtlHY21i8u82GgL7louxzkE3Mw2yRECPH9WFPSJDWfMR4mS+HbMvAi9xz7E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=L7v070tC; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L7v070tC" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-476a130c138so3625157f8f.0 for ; Mon, 17 Aug 2026 07:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786976635; x=1787581435; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=If9lDPMz2SaJWMhQWOQ1mzEz7CNmQ9kfipX5E+1z4B4=; b=L7v070tCovS+zR+RoIgCqPVTTqmE7uZgD7TELmh9PafRIBkAtgTgvmfnT9fPs1zx4l hIBl+RwI3kTdWtOm6X9qLhW6P746FrHb43Uodxf2bV2FyUp/rps3L8TyhmEs1CXAdokl 6G/cobSMLVdT8ZyZtcezjCqaC0h3CiCvdg3skjiakj8xiS+q3QIJeu88sIweHbjmZVPa cqxYj3PUN16rmIG9UF8TU1VT++d+418RxSOdZmlw/pPL+G/V09JwOK6x/n2juGnmyHvV D6xQp61L85rHP6hbIAkSG8jK1E16mhZ9y6iUKRpIcCYiZWNV6tfJnI6XLZlLzgEw0LZe bAOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786976635; x=1787581435; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=If9lDPMz2SaJWMhQWOQ1mzEz7CNmQ9kfipX5E+1z4B4=; b=E2nOiF0bHSYepzKj8h2e1/1qLkPLMAqia9mN3eOEa5N6EMCe6/NHM960MuffYE5zBi GvLHgZqzu2TJm1ZCK6vRQuK5OO6WuZEK/ZCy1O/IPCftgUnZlSHfKBdm1vJZLInsYftd 3JkWAOT+3YEUmFEAwYhLglWIG3euDHWzpmM0U4i+R6leOr6JmASRGmLpQ6MEvlZZAaPd /8I2HPYUgLL4VuAWkaSQDn0U2+1jZTAqlK+/w4A88fO4vZXXflp4/ktkF7MnrsJLr9hf t9vEsbF2tNJr/ndb+uVxuZlWKeeVZfwHOaP5x/KZbhLc8ZyuNslSC5YQfGbWv+LyA74X Assw== X-Forwarded-Encrypted: i=1; AHgh+RoDTrddVAs5/cXgfg6gLObMIV6jvD64EfwOwO9B5YH68duC6Dv3NPE289nFX/Hu0hu9J1pVJjufapHXdF4=@vger.kernel.org X-Gm-Message-State: AOJu0YwxCYbs0PR6h46zDsWOIhtIAdiPu4eVnlW0Y2CzT9Pb6pTrfxyh g9/dwJTIELpAoYC83P6gbNzb2hvVzzb65o965J5R+C+I0s/7TIzN+T2G X-Gm-Gg: AR+sD137xhxvGpCicqOH5Oi18eEHrzObG454DBCM5iZ3LWvPC0hOVkJAdU8m5t3qk2A jChZw66mirHBnac+72cSEhDTtx/SMy1g9Wtis790NtGqDRN+/CIHDUnoRpuR++PjnCnckRDJQhf 0B4IkvOQ8DQNda5sTzbJwAc4RvG1eSJ+K43bssSB6HkSgI7LPlv7FVYuyzntsh4tCv88bDIAsAW vCiZfRZCFCo/lyRTw4WpE7ia6TRPzmNognUZx92K3qxwBMTQeX1nrHNGrj0LfwFWNkVti1JDapM qSL+iK5kLYz60blXDBFOci9qawdCiQgxr2O+2Vhief8jraIxe8zkHKG+W6+hOIhIVfMumn0P8KQ aISy6a1Tt6ASXDot4FsDOnB2xng87WdnCU042y7IljgHJRwndoSFks5tC2fF9/JXylJJezOtBzQ ZiPOenhB8t3UJDmVscXzsnuTOKQb1m+QBhXbL6+HSPOXCMcvbcZyQBQHOR74awg1nai8/d2FB59 Bs7Lnt0HRcFBg+iZ6Q6FSmhtw== X-Received: by 2002:a05:6000:40c8:b0:481:568d:f119 with SMTP id ffacd0b85a97d-4816068c6admr36693220f8f.0.1786976635193; Mon, 17 Aug 2026 07:23:55 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482a5b77fa3sm4154065f8f.26.2026.08.17.07.23.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 07:23:54 -0700 (PDT) Date: Mon, 17 Aug 2026 15:23:50 +0100 From: David Laight To: Tung Quang Nguyen Cc: Ajith P V , "netdev@vger.kernel.org" , "tipc-discussion@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" , "jmaloy@redhat.com" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "horms@kernel.org" Subject: Re: [PATCH net-next v3] tipc: replace deprecated strcpy with strscpy in tipc_bearer_get_name() Message-ID: <20260817152350.573c4eff@pumpkin> In-Reply-To: References: <20260814160846.338273-1-ajithpv.linux@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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-Transfer-Encoding: 7bit On Mon, 17 Aug 2026 07:53:53 +0000 Tung Quang Nguyen wrote: > >Subject: Re: [PATCH net-next v3] tipc: replace deprecated strcpy with strscpy in > >tipc_bearer_get_name() > > > >> net tree: > >> https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git > >> net-next tree: > >> https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git > > > >Thank you. I tried the correct net-next tree. The same patch applied > >successfully here also as shown below. > > > >/net-next$ ls > >arch certs CREDITS Documentation fs init ipc Kconfig lib > >MAINTAINERS mm README samples security tools virt > >block COPYING crypto drivers include io_uring Kbuild kernel LICENSES > >Makefile net rust scripts sound usr > >/net-next$ git remote -v > >origin https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git > >(fetch) > >origin https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git > >(push) > >/net-next$ git am ../../patches/v3-0001-tipc-replace- > >deprecated-strcpy-with-strscpy-in-ti.patch > >Applying: tipc: replace deprecated strcpy with strscpy in > >tipc_bearer_get_name() /net-next$ git branch > >* main > >/net-next$ > > > >Am I missing something? > > I see that your patch was applied again successfully after failure. > There is one feedback from AI review that I see valid: > [...] > > @@ -209,7 +209,7 @@ int tipc_bearer_get_name(struct net *net, char *name, u32 bearer_id) > > if (!b) > > return -EINVAL; > > > > - strcpy(name, b->name); > > + strscpy(name, b->name, TIPC_MAX_BEARER_NAME); > This isn't a bug, but the destination capacity is now hard-coded in the > body while the interface says nothing about it. The declaration in > net/tipc/bearer.h is still: > int tipc_bearer_get_name(struct net *net, char *name, u32 bearer_id); > and the comment directly above the implementation only says: > * @name: a pointer to the buffer where the name will be stored. > Should the TIPC_MAX_BEARER_NAME requirement be spelled out in the comment > or in the prototype, so that the interface and the body agree? > In the current tree there is no behavioural change: the only caller is > __tipc_nl_add_monitor() in net/tipc/monitor.c, which declares > char bearer_name[TIPC_MAX_BEARER_NAME], and the source is > char name[TIPC_MAX_BEARER_NAME] in struct tipc_bearer, so the copy can > neither truncate nor overflow. > The strscpy() return value is also discarded, so a future caller passing a > smaller buffer would get a silently truncated name plus a return of 0. > Would passing a size_t len from the caller (sizeof(bearer_name)) and > forwarding strscpy()'s -E2BIG through the existing int return be preferable > to a hard-coded bound? > [...] > > Please update your patch and send the new version after Aug 31st. (Because net-next is closed now) > One 'solution' to the non-problem is to embed the array in a struct. Although (IIRC) this is a uapi constant so that may not be completely possible. Otherwise I'd ignore the AI review. David