From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B12AA0C40 for ; Wed, 28 Jul 2021 17:28:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 47E0A410FB; Wed, 28 Jul 2021 17:28:51 +0200 (CEST) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mails.dpdk.org (Postfix) with ESMTP id 7226340E64 for ; Wed, 28 Jul 2021 17:28:49 +0200 (CEST) Received: by mail-wr1-f48.google.com with SMTP id z4so3042102wrv.11 for ; Wed, 28 Jul 2021 08:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=GQxY29TYkeHqZ0/upypK9fK1/TTFUQDDF/UZgtyNt3Q=; b=JlaF1Z9RQ9lezaq0/O4Xu/KY48+bzFkFFhnNqItw0JI4RiqTD3O73FVmU3PzgOfE4r +5SZYtuHxdfulmsC9Koh35PyMusXskQYHAJ0EruvCmVS957oTfBduSaQLDIXgEVfeFIC AKe75zKdMapK0KAfeoLpLNBoL413J8c6z0bZ1Yk9HGA37P6i0AZpQr6ot+9Rb6gHQ49m ennF4jt9/Z+9gfP5RGIiqpFYX89clFcZsF+1vOqKGhq7eb0fI7Mgenhi7qQnMuAWnOcr BvtPoFplLhLmHHtOWVo+HdQA0R5rEp5x980VTszC2PQfuYNioeQDXpQiAf2hAh+hUQLN xB3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=GQxY29TYkeHqZ0/upypK9fK1/TTFUQDDF/UZgtyNt3Q=; b=VOdHmK2PbYdRNgX3pEnM5Rt6s5dMi0TNSEHEx9edSraNFNX2xDbK2QtPBY/mf763K6 JMYM+bMzZVt4+ZAxAgBCy9HhuqB49FGrSX6GW9pHJAoNE7YSiTQLIMYCi90QeQdYUrZQ LF6FEOsKvlblXKqEyTF1rWQ/VdPK43g73Lm45oGwFmbhJDbBoD1LjwIXUGzYxQ8x7bWh cScgiuTIjX783XXiKbDl2jPCnt92ro4fueUpK+HQR1YZuhw2LxIbfgjVnxmfwRtgBVlv X3wz33GkjOtD5fiD28aSb9uNF49/gx18rvDstqVa8aNVNE27NMqFTIZsq4swYFeKrnwP B8UA== X-Gm-Message-State: AOAM531+RLr7yDeNRSkTe/o2t230BCPAYtsNxbLDRQ105SFtlt0PlGuj DLsZItZ1k3oV0nCJ//KTE6JMfA== X-Google-Smtp-Source: ABdhPJzEPVHynVAFy4BBBHn1Gb7mEXhkBnGL+lst2R3eRzFwOyzCXn2wg0qKuLkQgUit3uULTcZPjQ== X-Received: by 2002:adf:c803:: with SMTP id d3mr31427753wrh.345.1627486129131; Wed, 28 Jul 2021 08:28:49 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id r2sm138369wrq.15.2021.07.28.08.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 08:28:48 -0700 (PDT) Date: Wed, 28 Jul 2021 17:28:47 +0200 From: Olivier Matz To: Eli Britstein Cc: dev@dpdk.org, Ilya Maximets , Gaetan Rivet , Majd Dibbiny , Asaf Penso , Thomas Monjalon , Harry Van Haaren , stable@dpdk.org Message-ID: References: <20210713064910.12793-1-elibr@nvidia.com> <20210713064910.12793-3-elibr@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210713064910.12793-3-elibr@nvidia.com> Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH 2/3] mbuf: avoid cast-align warning in pktmbuf mtod offset macro X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Tue, Jul 13, 2021 at 09:49:09AM +0300, Eli Britstein wrote: > In rte_pktmbuf_mtod_offset macro, there is a casting from char * to type > 't', which may cause cast-align warning when using gcc flags > '-Werror -Wcast-align': > > .../include/rte_mbuf_core.h:723:3: error: cast increases required alignment > of target type [-Werror=cast-align] > 723 | ((t)((char *)(m)->buf_addr + (m)->data_off + (o))) > | ^ > > As the code assumes correct alignment, add first a (void *) casting, to > avoid the warning. > > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org > > Signed-off-by: Eli Britstein My initial thinking was that it's the problem of the application: if -Werror=cast-align is used, it is up to the application to cast the return value of rte_pktmbuf_mtod_offset() to (void *) before casting it to the network type. But, if I understand correctly, the problem is not about the application code itself, but about inlined code in the header files of dpdk (i.e. compiling an empty C file that just includes the dpdk headers with -Werror=cast-align). Is it correct? If yes I think it should be highlighted in the commit log. Out of curiosity, how did you find the errors? I mean, is it possible that some casts are missing some other headers, or is this patchset exhaustive? Thanks, Olivier > --- > lib/mbuf/rte_mbuf_core.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h > index bb38d7f581..dabdeee604 100644 > --- a/lib/mbuf/rte_mbuf_core.h > +++ b/lib/mbuf/rte_mbuf_core.h > @@ -720,7 +720,7 @@ struct rte_mbuf_ext_shared_info { > * The type to cast the result into. > */ > #define rte_pktmbuf_mtod_offset(m, t, o) \ > - ((t)((char *)(m)->buf_addr + (m)->data_off + (o))) > + ((t)(void *)((char *)(m)->buf_addr + (m)->data_off + (o))) > > /** > * A macro that points to the start of the data in the mbuf. > -- > 2.28.0.2311.g225365fb51 >