From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BCBDC433EF for ; Tue, 28 Sep 2021 09:32:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 274A561159 for ; Tue, 28 Sep 2021 09:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239818AbhI1JeT (ORCPT ); Tue, 28 Sep 2021 05:34:19 -0400 Received: from mga07.intel.com ([134.134.136.100]:29357 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239724AbhI1JeS (ORCPT ); Tue, 28 Sep 2021 05:34:18 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10120"; a="288319708" X-IronPort-AV: E=Sophos;i="5.85,329,1624345200"; d="scan'208";a="288319708" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 02:32:39 -0700 X-IronPort-AV: E=Sophos;i="5.85,329,1624345200"; d="scan'208";a="476227861" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.163]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 02:32:35 -0700 Received: by lahna (sSMTP sendmail emulation); Tue, 28 Sep 2021 12:32:32 +0300 Date: Tue, 28 Sep 2021 12:32:32 +0300 From: Mika Westerberg To: Arnd Bergmann Cc: Andreas Noever , Michael Jamet , Yehezkel Bernat , Arnd Bergmann , Greg Kroah-Hartman , Isaac Hazan , Lee Jones , Rikard Falkeborn , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] thunderbolt: fix -Wrestrict warning Message-ID: References: <20210927131620.1587294-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210927131620.1587294-1-arnd@kernel.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Mon, Sep 27, 2021 at 03:16:11PM +0200, Arnd Bergmann wrote: > 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 Applied, thanks!