From patchwork Mon Sep 27 13:16:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 514688 Delivered-To: patch@linaro.org Received: by 2002:a17:906:f46:0:0:0:0 with SMTP id h6csp3932065ejj; Mon, 27 Sep 2021 06:16:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyW6E4B2gRtSHQ7mFuTNW5t3NYtScS9vK/clWLqc0zQLkj+LBDMwBEzUaz7CBZdkHnmSV55 X-Received: by 2002:a17:906:498b:: with SMTP id p11mr26265427eju.295.1632748588457; Mon, 27 Sep 2021 06:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632748588; cv=none; d=google.com; s=arc-20160816; b=0RNogW8tWqOkw8Cusn1K0VZMg+fmI4csJ69K0NKsk5z2dKILN1+2+vypqzCzWMZ+8J RcWjvdV9DoEGdDsoUufDlmzkzlj94ZCc8tXtIVG/FXw6UYCvq6CyHUUwYmJw5Rlam31z qubenMkgYJPcxy2Luh7+K7PiNulQm8aribflR1r9gv0WWvhgdAAAgcd009rahNYtyAQJ XfZSBZ6buFyPdTGzYNIGWHeAkeRmIg9DCz3FpRDxP+SegrEY2d1sukZ98YeK8DYAM/6U jJOuN5WLVyI+Em2AfwXGEODjW6rD0F8CPeYSWQ9ipbzShv6oSfIcL+thIka62+3jpGpv VfKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=jDzjUw8c7wBGOhttxLtFyqmt967bXcjP3PpByLn6mCw=; b=G1end3AADSo01ZzDAfnAPksIjwL1Y4RkYFjDgAHd1WHxWaQR3bp+M9JRgkCom8+wfC C0xhCPS2nMXL2Y2tJcCqgmqKIUpnMQcHPVViwOwFcSE+mZHkulcjD2RON5RORgaxyj0N 6BHGTU1xl8Fq4r5Zp+g7ADSMfTFs1E11AGWVaDYRW5Kngd0Lg7rIEL2C8ha/sY3/siMV xzUKpJmqgydLg+FFzLctOZp9hJFFIvjzdRp/Mss5Oz6au6JWlEztEyJEEWHdU4lhdn2p SeRKBNLbJLjmvjPakF3R60+JucNWkgiUxsrnZyxkE62jQF4CkCtXLcnW4HIWwGsI0Tv0 Ip6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nbGW5gnR; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd14si18280839edb.36.2021.09.27.06.16.28; Mon, 27 Sep 2021 06:16:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-usb-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=@kernel.org header.s=k20201202 header.b=nbGW5gnR; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234553AbhI0NSE (ORCPT + 4 others); Mon, 27 Sep 2021 09:18:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:53374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234421AbhI0NSE (ORCPT ); Mon, 27 Sep 2021 09:18:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5C0B96103B; Mon, 27 Sep 2021 13:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632748586; bh=9bpIpSEjgHZGeH5+f9MLQYWRNrb/wOzN0Uc8dGTvIXc=; h=From:To:Cc:Subject:Date:From; b=nbGW5gnR6p34uEetecTHU1DNuwfp3IRIv4cQs6RMIkTMVfXzK59SVI+0zgt+1TvnL 2CmcgtNz3oDs1tQAQOCWSdWo2vTboPdFe3O/H1MubHRrAYsxqMOAyFyYnaXMP/zK/q 67DAzCV2mDv8GfRaENH1SA5GQNeUFTccY4mmtJrsjn0d9hjLijEMTGInAVfASPOMIa dyURFE7DHmeIYwarXWumHb0mnROr7nQ6FljlcvbuNjww7B/na2HB5Wf/wwkLJHVC6L ecn0BJ5B4wzxRHpfEVEVvpImD5+021Q2pvXrMAxSmf/8x0RdepcM/NL7GIoaHP+FaN oK3bO25sU7lTg== From: Arnd Bergmann To: Andreas Noever , Michael Jamet , Mika Westerberg , Yehezkel Bernat Cc: Arnd Bergmann , Greg Kroah-Hartman , Isaac Hazan , Lee Jones , Rikard Falkeborn , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] thunderbolt: fix -Wrestrict warning Date: Mon, 27 Sep 2021 15:16:11 +0200 Message-Id: <20210927131620.1587294-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Arnd Bergmann gcc-11 warns when building with W=1: drivers/thunderbolt/xdomain.c: In function 'modalias_show': drivers/thunderbolt/xdomain.c:733:16: error: 'sprintf' argument 3 overlaps destination object 'buf' [-Werror=restrict] 733 | return sprintf(buf, "%s\n", buf); | ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/thunderbolt/xdomain.c:727:36: note: destination object referenced by 'restrict'-qualified argument 1 was declared here 727 | char *buf) | ~~~~~~^~~ There is no need for the sprintf() here when a strcat() does the same thing. Signed-off-by: Arnd Bergmann --- drivers/thunderbolt/xdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.29.2 diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c index d66ea4d616fd..eff32499610f 100644 --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c @@ -730,7 +730,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, /* Full buffer size except new line and null termination */ get_modalias(svc, buf, PAGE_SIZE - 2); - return sprintf(buf, "%s\n", buf); + return strlen(strcat(buf, "\n")); } static DEVICE_ATTR_RO(modalias);