Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7518328rdb; Wed, 3 Jan 2024 21:08:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUZoa7xrtOCqmVYpuOy4iPEImNjyEy7T2Pk+eHr0YI2lWBi39Q/qFkZB82MEQqPDrZ8nz+ X-Received: by 2002:ad4:5cc4:0:b0:67f:ae69:331e with SMTP id iu4-20020ad45cc4000000b0067fae69331emr119224qvb.72.1704344887976; Wed, 03 Jan 2024 21:08:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704344887; cv=none; d=google.com; s=arc-20160816; b=uSmsHuwsIDpfgaiTmUfgFx590wk+MO9tN9CWfcn2fEpXBExC38Q3scHu4Om2ia1plR ctIGJvzhjDriutMB9j0wXcfMWn/VVdHi8hdBQyG5VtY7oPZUUQTWSila/ZfkI1G+1UZk pNuUjnos+PslLmGQruJAAPj4XWcjdCKFSghxbmv9WkHEwJEav7LFxYqQQh1Bfdh+lQiB YdhIQVzQKXjnzKwwmSzl9bjDex+TBeBYQNpNxA8ZNGsnEgcfDNNJZoTrjuU/eHQhth5P 7yuRl1AhNcytay9+l362OgGsnX/7K9YtaSdojfxmspyj0gOWZj8RMZPG7sR2J5oOVMdA aBcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=NR4TAdpORcUfD0xhX/PDqB5I0l6LiG232iyhYtTdcXk=; fh=xkTsCfeNW9WX/uPbwHHc5gd93dQPrwfDi82gCcXa/1g=; b=R2mfaxR+oBf5A9UDx6hxEMDRdu99oFVeTSr6Ruq9BFJkUjESSbisanKnk+586p4yp3 jrflx1gP50dN+9Jno/ILuC3PGAGTrFLb7q+pnruiquqRXRAUjkW01smOeblQuuMFHkYk xWP9leMjc7AQpkWg/GLxohWIxyC8IZiTqwJGsVuYm1LCRrcMxyhrmOsF/2Ytej4vwIb/ CwzW9oZzbrW2GkfV9ah5Qi8CaBSMdkFO9qsM16eSCKI1rnhGq5LwOHP12C6ZLzxL1N4i JFpFx0i748XMALSdDj1CuSWMjnV7UPLnDuOE/AEdisWAnb4lySPCCwaeL+7FklziS9Mf 2NZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Xzbd5741; spf=pass (google.com: domain of linux-kernel+bounces-16254-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16254-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t18-20020a0cb712000000b0067f91bab6bfsi27759372qvd.89.2024.01.03.21.08.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 21:08:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16254-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=@broadcom.com header.s=google header.b=Xzbd5741; spf=pass (google.com: domain of linux-kernel+bounces-16254-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16254-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com 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 A376F1C24C4B for ; Thu, 4 Jan 2024 05:08:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80CB31862D; Thu, 4 Jan 2024 05:07:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Xzbd5741" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (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 58A2A18647 for ; Thu, 4 Jan 2024 05:07:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-db4364ecd6aso121755276.2 for ; Wed, 03 Jan 2024 21:07:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1704344876; x=1704949676; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NR4TAdpORcUfD0xhX/PDqB5I0l6LiG232iyhYtTdcXk=; b=Xzbd5741oyKnhhvoEHSeULcVgIj6YBH1khLLgns8y9PBG9eorUYHxMDjmEOSqzXdvq +yy2UPFFKQpGIvKOWoFVyVszX8zBkbIb+8Z4sRJXgIbHFyQXGaJ6MCVfnJ+c7I2QtsMz KI/tIjv1V6vFWxIaLEKCFNvcWSzmXtPFRYCxU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704344876; x=1704949676; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NR4TAdpORcUfD0xhX/PDqB5I0l6LiG232iyhYtTdcXk=; b=Ul4f0Aj3ov42xbEyGrPpTS1TzuhJpjEsSnLfKmjsCdzzU2oWTC7gmBcRPfZgzcB6h6 ILpEGBgMNs1SRorbtjlKT8OiaKXoO9I3VYZ1RDfT6EaeNoAb0rPTwqhNKvcWPnvmhch7 /488064Ic9EELL+SIf3U/zvDnnmz0soMB6EriaTerR3zgDS1Z8yHrB1+y8tZ39n4T7xM oxb5ZKvR4lzBp/vJIhpTpHN3dTuLAu53PfrJS52hp02wl7Rebcpw/AuK9pe/IrcdKYJg x2qGfNnJfHnhjrU0dV+pFPmy+cMA5SkMJqU5I3IQdfVd9nwqjuOxe6856dT2kalLC14x fV8Q== X-Gm-Message-State: AOJu0Yxm3MpNc+HCC/lc6ItPTzo1rWZL18lYe3YnogZjYFxb1VuxejjM m2pKHNFKsb2C3J/YCG4Wm9QJgLM8sh63IsBYxPYJRXaLcoiN6Vg6QatVhew= X-Received: by 2002:a25:ab93:0:b0:dbd:5d43:953 with SMTP id v19-20020a25ab93000000b00dbd5d430953mr69780ybi.43.1704344876252; Wed, 03 Jan 2024 21:07:56 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231127204206.3593559-1-zack@kde.org> <20240104050605.1773158-1-zack.rusin@broadcom.com> In-Reply-To: <20240104050605.1773158-1-zack.rusin@broadcom.com> From: Zack Rusin Date: Thu, 4 Jan 2024 00:07:45 -0500 Message-ID: Subject: Re: [PATCH v2] input/vmmouse: Fix device name copies To: linux-kernel@vger.kernel.org Cc: Dmitry Torokhov , Arnd Bergmann , Robert Jarzmik , Raul Rangel , linux-input@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 4, 2024 at 12:06=E2=80=AFAM Zack Rusin wrote: > > Make sure vmmouse_data::phys can hold serio::phys (which is 32 bytes) > plus an extra string, extend it to 64. > > Fixes gcc13 warnings: > drivers/input/mouse/vmmouse.c: In function =E2=80=98vmmouse_init=E2=80=99= : > drivers/input/mouse/vmmouse.c:455:53: warning: =E2=80=98/input1=E2=80=99 = directive output may be truncated writing 7 bytes into a region of size bet= ween 1 and 32 [-Wformat-truncation=3D] > 455 | snprintf(priv->phys, sizeof(priv->phys), "%s/input1", > | ^~~~~~~ > drivers/input/mouse/vmmouse.c:455:9: note: =E2=80=98snprintf=E2=80=99 out= put between 8 and 39 bytes into a destination of size 32 > 455 | snprintf(priv->phys, sizeof(priv->phys), "%s/input1", > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 456 | psmouse->ps2dev.serio->phys); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > v2: Use the exact size for the vmmouse_data::phys > > Signed-off-by: Zack Rusin > Fixes: 8b8be51b4fd3 ("Input: add vmmouse driver") > Cc: Dmitry Torokhov > Cc: Arnd Bergmann > Cc: Robert Jarzmik > Cc: Raul Rangel > Cc: linux-input@vger.kernel.org > Cc: # v4.1+ > --- > drivers/input/mouse/vmmouse.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.= c > index ea9eff7c8099..74131673e2f3 100644 > --- a/drivers/input/mouse/vmmouse.c > +++ b/drivers/input/mouse/vmmouse.c > @@ -63,6 +63,8 @@ > #define VMMOUSE_VENDOR "VMware" > #define VMMOUSE_NAME "VMMouse" > > +#define VMMOUSE_PHYS_NAME_POSTFIX_STR "/input1" > + > /** > * struct vmmouse_data - private data structure for the vmmouse driver > * > @@ -72,7 +74,8 @@ > */ > struct vmmouse_data { > struct input_dev *abs_dev; > - char phys[32]; > + char phys[sizeof_field(struct serio, phys) + > + strlen(VMMOUSE_PHYS_NAME_POSTFIX_STR)]; > char dev_name[128]; > }; > > @@ -452,7 +455,8 @@ int vmmouse_init(struct psmouse *psmouse) > psmouse->private =3D priv; > > /* Set up and register absolute device */ > - snprintf(priv->phys, sizeof(priv->phys), "%s/input1", > + snprintf(priv->phys, sizeof(priv->phys), > + "%s" VMMOUSE_PHYS_NAME_POSTFIX_STR, > psmouse->ps2dev.serio->phys); > > /* Mimic name setup for relative device in psmouse-base.c */ Sorry, I missed the original discussion of this during the VMware->Broadcom email transition. How about we just use the exact sizing then like in the v2? z