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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBC89C4338F for ; Thu, 19 Aug 2021 08:11:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2F8B60FDA for ; Thu, 19 Aug 2021 08:11:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237205AbhHSILh (ORCPT ); Thu, 19 Aug 2021 04:11:37 -0400 Received: from mga14.intel.com ([192.55.52.115]:5623 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237128AbhHSILf (ORCPT ); Thu, 19 Aug 2021 04:11:35 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10080"; a="216235396" X-IronPort-AV: E=Sophos;i="5.84,334,1620716400"; d="scan'208";a="216235396" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2021 01:10:58 -0700 X-IronPort-AV: E=Sophos;i="5.84,334,1620716400"; d="scan'208";a="594354462" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2021 01:10:56 -0700 Received: from paasikivi.fi.intel.com (localhost [127.0.0.1]) by paasikivi.fi.intel.com (Postfix) with SMTP id F2981203D0; Thu, 19 Aug 2021 11:10:53 +0300 (EEST) Date: Thu, 19 Aug 2021 11:10:53 +0300 From: Sakari Ailus To: Andy Shevchenko Cc: kernel test robot , Nick Desaulniers , clang-built-linux , kbuild-all@lists.01.org, Linux Kernel Mailing List , Thomas Zimmermann , Petr Mladek Subject: Re: drivers/media/v4l2-core/v4l2-ioctl.c:303:28: warning: taking address of packed member 'pixelformat' of class or structure 'v4l2_pix_format_mplane' may result in an unaligned pointer value Message-ID: <20210819081053.GW3@paasikivi.fi.intel.com> References: <202107150148.RpWnKapX-lkp@intel.com> <20210716114105.GF3@paasikivi.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 16, 2021 at 03:12:11PM +0300, Andy Shevchenko wrote: > On Fri, Jul 16, 2021 at 02:41:05PM +0300, Sakari Ailus wrote: > > On Wed, Jul 14, 2021 at 10:45:26PM +0300, Andy Shevchenko wrote: > > > > >> drivers/media/v4l2-core/v4l2-ioctl.c:347:37: warning: taking address of packed member 'pixelformat' of class or structure 'v4l2_sdr_format' may result in an unaligned pointer value [-Waddress-of-packed-member] > > > > > > Why is it packed in the first place? Is it used on unaligned addresses > > > in other structures? But even so, why should it matter? > > > > It's packed since we wanted to avoid having holes in the structs. There are > > other ways to do that but it's ABI dependent and is prone to human errors, > > too. > > What holes can you think about in the above mention structure? Probably not that one but it has happened in the past that the struct memory layout has been unintentionally different in different ABIs and that has not been the intention, but rather a bug. Packing has been added in newer structs to avoid that. -- Sakari Ailus