From patchwork Thu May 29 17:24:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 31142 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 20458203E6 for ; Thu, 29 May 2014 17:25:07 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id hy4sf2622503vcb.8 for ; Thu, 29 May 2014 10:25:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=MBXi4uM5My4HLH2FUIflD19iVvm5kkDwmcNtf81ZgK0=; b=bPsu2P1qIqB4Y16aHPnayMWGvIkrGdnnbPHeGJ8F9M3bY3nx1eJJ5TfhatH4oLQP+r oLv1/fdBYUcIYHmXdjB0H762hy2lbINv2YFjSNi4rSQHPabQx+kGAGsbiHuet4UpK/JC z+F5ZwhGFX+I5uTFfbkqMXHqwUIztoIK1QOJa8rmUVK5/lzcf0dL6EOhbNVxnggDQi3T TKw/zXqlfcQgpxFkVfI8lZKMNgiupTabBIy8nluWZA8bhtSuVrwYxSYQiTyNc6zopQih 1iCRFI5qBMASufKJQ5p7oap3CzEzpcrEi6YnnOcuLW1hfh+NAiIRajAs7E9aZzvm5bBR 12fA== X-Gm-Message-State: ALoCoQnb+gqwfe+BRjrZ/z+mxpH00uqAN8+nwp+k1lQr9av7yFV5u8Op19MsdGWgq8FFHIHxCICl X-Received: by 10.58.30.108 with SMTP id r12mr3546184veh.17.1401384306532; Thu, 29 May 2014 10:25:06 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.247 with SMTP id b110ls739374qge.16.gmail; Thu, 29 May 2014 10:25:06 -0700 (PDT) X-Received: by 10.220.92.135 with SMTP id r7mr8079006vcm.11.1401384306240; Thu, 29 May 2014 10:25:06 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id dz3si1017705vdc.48.2014.05.29.10.25.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 May 2014 10:25:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id hy4so735885vcb.40 for ; Thu, 29 May 2014 10:25:06 -0700 (PDT) X-Received: by 10.220.44.141 with SMTP id a13mr2487381vcf.71.1401384306152; Thu, 29 May 2014 10:25:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp45796vcb; Thu, 29 May 2014 10:25:05 -0700 (PDT) X-Received: by 10.224.165.148 with SMTP id i20mr12023595qay.41.1401384305677; Thu, 29 May 2014 10:25:05 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id r9si1833198qci.19.2014.05.29.10.25.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 May 2014 10:25:05 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Wq43S-0005Ig-Co; Thu, 29 May 2014 17:23:50 +0000 Received: from mail-lb0-f172.google.com ([209.85.217.172]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Wq43M-0005Ib-Ot for lng-odp@lists.linaro.org; Thu, 29 May 2014 17:23:44 +0000 Received: by mail-lb0-f172.google.com with SMTP id l4so379435lbv.31 for ; Thu, 29 May 2014 10:24:53 -0700 (PDT) X-Received: by 10.112.50.241 with SMTP id f17mr6985521lbo.7.1401384292933; Thu, 29 May 2014 10:24:52 -0700 (PDT) Received: from localhost.localdomain ([81.200.0.212]) by mx.google.com with ESMTPSA id bg4sm1181804lbb.6.2014.05.29.10.24.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 May 2014 10:24:51 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 29 May 2014 21:24:47 +0400 Message-Id: <1401384287-22415-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 X-Topics: patch Subject: [lng-odp] [PATCH] get rid of not sized array at middle of the struct X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Compilation with c99 finds warning: field 'buf_hdr' with variable sized type 'odp_buffer_hdr_t' (aka 'struct odp_buffer_hdr_t') not at the end of a struct or class is a GNU extension This happens because odp_buffer_hdr_t struct has payload[] at the and this struct is a part of other struct: typedef struct odp_buffer_chunk_hdr_t { odp_buffer_hdr_t buf_hdr; <- payload[] here odp_buffer_chunk_t chunk; } odp_buffer_chunk_hdr_t; This patch is propose to fix launchpad bug 1274577. Signed-off-by: Maxim Uvarov --- platform/linux-generic/include/odp_buffer_internal.h | 6 ++---- platform/linux-generic/source/odp_buffer_pool.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index a1a6b4e..f2d409b 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -92,12 +92,10 @@ typedef struct odp_buffer_hdr_t { int type; /* type of next header */ odp_buffer_pool_t pool; /* buffer pool */ - uint8_t payload[]; /* next header or data */ + uint8_t pad[32]; /* to pass check_align() */ + /* next header or data just after this sctuct */ } odp_buffer_hdr_t; -ODP_ASSERT(sizeof(odp_buffer_hdr_t) == ODP_OFFSETOF(odp_buffer_hdr_t, payload), - ODP_BUFFER_HDR_T__SIZE_ERROR); - typedef struct odp_buffer_chunk_hdr_t { odp_buffer_hdr_t buf_hdr; diff --git a/platform/linux-generic/source/odp_buffer_pool.c b/platform/linux-generic/source/odp_buffer_pool.c index 90214ba..0687bcb 100644 --- a/platform/linux-generic/source/odp_buffer_pool.c +++ b/platform/linux-generic/source/odp_buffer_pool.c @@ -206,7 +206,7 @@ static void fill_hdr(void *ptr, pool_entry_t *pool, uint32_t index, { odp_buffer_hdr_t *hdr = (odp_buffer_hdr_t *)ptr; size_t size = pool->s.hdr_size; - uint8_t *payload = hdr->payload; + uint8_t *payload = (uint8_t*)hdr + sizeof(odp_buffer_hdr_t); if (buf_type == ODP_BUFFER_TYPE_CHUNK) size = sizeof(odp_buffer_chunk_hdr_t);