Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp428150pxb; Thu, 26 Aug 2021 06:28:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyel0Zcd0aScBMspyaAdQr91w830NuPhHhs3m3gmMYz36j0LMauzq/Ta+upSsS4gzzoI9XQ X-Received: by 2002:a17:906:8da:: with SMTP id o26mr4197359eje.424.1629984537234; Thu, 26 Aug 2021 06:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629984537; cv=none; d=google.com; s=arc-20160816; b=RaVisDi4pHk9dnntxVnxp6cs5txuXJ2pzqjBC1bH6FRoVLtOJNx9WKrAMX+bCMW/t0 WDNktQddiNxDCi0z00t8Nvv+HwOjElofo/0CFqwI6MlHRMcxftNnc1qObOyDTtAvgq6h S/bNdT9viqo8iD1DFN4MvH1Xddi91XzIzHlAW+qyIOmwg6+CIPt1D0mMcygGwVbvn2FH Mbjxoz4kvaujjFt1ixhPhKfPFwylLHjkQKkJbyCFhIibxoEC3Qf5K0VsHzFUDFayyuNj thOFrKL3P5DY3VHSsXLqzS+BrYg+FLbGD+ZYUGqyQr9rpn7NipxzpUAkADfpLIEte+3Y Prlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PLvumcZvpq67fhsZlC53oM4Ky7cTiR667Yrn4EucAoA=; b=A4g7etbdNcCE7Blcyd+UjPGwvMKivEK41U/Jck4hq0XGHdSBWNTmxQpUnLB889ws5r 4b2aoY2Muhyp6jGB/1NR/kD/2yaM4+wYI/86YuHl+OGSWqB8NhO9568QXqCyvi8iSDkX CqCd82LGVyj87lyyqyCN9aQXdr0bnaRgOQ/EQRLy4qjRwhjlnTQelOlw37JNAwRbRHPv /7iibgFP6esf1gq96hzdxgZoTuT6saowHhryui0ubur5ObG0o5atHomUaqJSA1sV2r36 k2bcNyBci3u/8HBGure2slE5khCgVBWsU4oW5+sjRCgJAWFFVyF0aE7kszHcn4CmTnUd R9dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=HFAbyj7l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j7si3655194ejm.280.2021.08.26.06.28.21; Thu, 26 Aug 2021 06:28:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@suse.com header.s=susede1 header.b=HFAbyj7l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241385AbhHZNXk (ORCPT + 99 others); Thu, 26 Aug 2021 09:23:40 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:54454 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230288AbhHZNXk (ORCPT ); Thu, 26 Aug 2021 09:23:40 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 4D6F11FD59; Thu, 26 Aug 2021 13:22:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1629984172; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PLvumcZvpq67fhsZlC53oM4Ky7cTiR667Yrn4EucAoA=; b=HFAbyj7lzW5m6F0kE9WmxPdhOT5ZQ3Cb9hnXWV+XN7YchRB1XQcFGoa1tWPbxzDHqEODyE FhNhdV+HrOGtoehIdrPMJKo+K6uCZyfV+DknqVl2eN0vzQf51yQlsQqf87fTS8Cbn4y7FZ XOpuWjXz4zJ1quc9HFxx1bWWeRJ2Hvo= Received: from suse.cz (unknown [10.100.224.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id BFC36A3B8D; Thu, 26 Aug 2021 13:22:51 +0000 (UTC) Date: Thu, 26 Aug 2021 15:22:51 +0200 From: Petr Mladek To: Sakari Ailus Cc: Andy Shevchenko , kernel test robot , Nick Desaulniers , clang-built-linux , kbuild-all@lists.01.org, Linux Kernel Mailing List , Thomas Zimmermann 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: References: <202107150148.RpWnKapX-lkp@intel.com> <20210716114105.GF3@paasikivi.fi.intel.com> <20210819081053.GW3@paasikivi.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210819081053.GW3@paasikivi.fi.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2021-08-19 11:10:53, Sakari Ailus wrote: > 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] > > > > Is there any plan to fix this, please? > > > > 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. What kind of bugs did the different ABI caused, please? Incompatibly between 3rd party drivers that were built with different compilers? I am not familiar with these problems. I wonder if there is a better solution. I guess that it might be a common problem affecting most drivers. Anyway, the non-aligned struct members might create slower code. > Packing has been added in newer structs to avoid that. And this smells with cargo-cult programming. People might make all new structures packed even when it is not really needed. Best Regards, Petr