From nobody Sat Jul 25 05:59:38 2026 Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) (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 E4B1C38D687 for ; Fri, 24 Jul 2026 21:56:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.199 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784930190; cv=none; b=GrRbJ25dyUuqUW7hVfZ8NZAQfYhl0khw5WmB5VBGCG7PSG/3BHpD21SVHClu81NprAcK57KXQQ1p4iMiPmfbEP8WO8Od+Ez1MuYwTXC5NQlWrO/5R2MaV8ycsnxJBClwPKsago0KhGbZ8WFnSOnBp67NG0rYEizztOQr7gt61d8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784930190; c=relaxed/simple; bh=kAWgstcYAXfhOYASQ6fi9LEUKfgTq5CGukshU6txNSU=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=n3LqVMczoFn5MGf35sbSmSw85zhQeEuGkTcGorLyv1Y6xczIg5IThnAkG3PDVlt8MSNyjxjYo5cmeUdppE1ro3rXQZyH6jA8wIqj9mWW9T/8/w0OAaScuUnFEuklr4xLqe/aNgKvmTCNEyjpyn8ews94daGwXxNe7NlDHlth3w4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--nkapron.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nQoGdmP7; arc=none smtp.client-ip=209.85.167.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--nkapron.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nQoGdmP7" Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-4ab4ca7ce3fso756278b6e.0 for ; Fri, 24 Jul 2026 14:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784930184; x=1785534984; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=c/UKAkW4BO4cMyvkKTsk4jsdrcWeqN0nKSN0zDbGXYY=; b=nQoGdmP7rg90bgPPRWXiv1zSCvvcXY64yWVV/14sh7kMneo4rfV+g5PO1pDBz+W2Jq puHqHAKRh6jab7Z7pJUPBri41IlgE8p6jagndOWDuXOg9DPQuxQq2w72oVJmK1dnuzlr cg9y8Ay7ErNrRsaiQbF6e0nKgCTRu4Ge4mwGRMMamembtkNOL7xISunbG2r7A8rGNM/l 8FmGhrkvymEqYCP75d1QjB0TnITK+v2Ew6g9d/YOL23syxabFVmse8kglbVpyNXII4Fl ngA6jd8ihouChVq6N26z6VltimH+Q7X3LicgvRA4xsYJXgr1Vtw4kp93o9gfoEMrWFIr x6Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784930184; x=1785534984; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=c/UKAkW4BO4cMyvkKTsk4jsdrcWeqN0nKSN0zDbGXYY=; b=JXZ+Myw/EUaaO8gunpgVGJx2pBHdsghINEXWN4fZIQWFa6oZtiEnu0du+V1ykZY+UP DT8+mH/B979oMx6kytXYrJaiSl2g3hXJpoTinnbOYk2Fy3NdLWWjb4j6UorJBXOiKJAj DUkziAEi7Wbe9/Cu2h4OebsQ0UqC4aN742Rk/vFfhCXqGiXi/E/nW0VL+pMfHaRUmab4 6gDoNhqwsXcrF1lsUBKg0vVK+TjR2d7mog9082ldja4FC9F0hBSpWuYPHOYsFiMyEUcE XmjnL+PZooYTsUby5atzKi5mrxB6C8miw01KYRoFhqWHTytIzAoUKi1+/WmET3ycMO5t nT0A== X-Forwarded-Encrypted: i=1; AHgh+Rohuc7FSFtVUvxlzvRI0ty7WQ+jwPANzCgHVXczLoYuHUN5J9yKOkHRqao0p27yMkfo/fvXwDJzlUtxaHA=@vger.kernel.org X-Gm-Message-State: AOJu0YwIaI+OBz9ZeoqHh8jB+bNsTmbwg1p6CXnsbCnQ0q3SX3hwmPIY 6TuKZZPdOA4zo63ZfvUSExv+SMNlVAjfUUb0j4qXOLE+mcIP8aO/lRsN7FFt3EKDZiMpVJSFwNI RFvAEFnojhA== X-Received: from ilbdx20-n1.prod.google.com ([2002:a05:6e02:4214:10b0:506:815:32fa]) (user=nkapron job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6808:1b27:b0:4a0:d9a1:1a94 with SMTP id 5614622812f47-4ab6a13ca4bmr256086b6e.19.1784930184124; Fri, 24 Jul 2026 14:56:24 -0700 (PDT) Date: Fri, 24 Jul 2026 21:56:14 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.229.g6434b31f56-goog Message-ID: <20260724215615.4160303-1-nkapron@google.com> Subject: [PATCH] usb: gadget: f_fs: Fix -Wformat-truncation in proxy endpoint names From: Neill Kapron To: Greg Kroah-Hartman , Neill Kapron Cc: kernel-team@android.com, kernel test robot , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When using the functionfs rw_proxy feature, proxy endpoint names are generated by appending "_rw" to the base endpoint name. The base endpoint name is copied via `snprintf` into an 8-byte buffer (`comp->name`). On some architectures (e.g., s390), the compiler flags a `-Wformat-truncation` warning because `%s_rw` could potentially overflow if the source string is unexpectedly long. Fix this by specifying a maximum field width of 4 characters when formatting the endpoint name string. This guarantees that at most 4 characters plus the 3 characters "_rw" (and null terminator) will be written, fitting within the 8-byte limit. Note that this is purely to address the compiler static analysis. In practice, `FFS_MAX_EPS_COUNT` is limited to 31, meaning the longest possible base endpoint name is "ep30", and therefore the resulting proxy name, "ep30_rw", is exactly 7 characters. Fixes: 0f0ea552cd21 ("usb: gadget: f_fs: Introduce rw_proxy file descriptor= s") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202607111052.PRRGX3Jq-lkp@int= el.com/ Assisted-by: Antigravity:gemini-3.1-pro Signed-off-by: Neill Kapron --- drivers/usb/gadget/function/f_fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/functi= on/f_fs.c index 073c4cbd90fb..3f0b445aba19 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -2441,7 +2441,7 @@ static int ffs_epfiles_create(struct ffs_data *ffs) mutex_init(&comp->mutex); mutex_init(&comp->dmabufs_mutex); INIT_LIST_HEAD(&comp->dmabufs); - snprintf(comp->name, sizeof(comp->name), "%s_rw", + snprintf(comp->name, sizeof(comp->name), "%.4s_rw", epfiles[i].name); err =3D ffs_sb_create_file(ffs->sb, comp->name, comp, &ffs_epfile_operations); --=20 2.55.0.229.g6434b31f56-goog