Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4644307imm; Mon, 14 May 2018 10:26:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoUYb2U5WPPR6TcXFIFbzFAKhA00s/1HjlQZWe3NdfRAqIh/fE/XmA2bStokYwtPi5s3HWo X-Received: by 2002:a62:8dc9:: with SMTP id p70-v6mr11451224pfk.72.1526318818442; Mon, 14 May 2018 10:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526318818; cv=none; d=google.com; s=arc-20160816; b=fXmMpUXnvAWHoeMPmQkLwdv3X18zHMT/OnwtFAOb2nPYetW3FecS7hsH9hKyRPiZ93 uIBLRAAeV4rLTaKkJna+/4DiXBUwA/t+Sym1cpwtyRBI8fGznlhv2KpizHajU/7On3ND Oo/QtUvQZNttcMIVCIFT6l/7XhIrBfhqDkQizrop+jNTPLUMtnM1fNuHDWgI9Tsl7XII 2sqBAOVO8yKTZpO7VqK7hD+dWINOqNEIO3SVc4qNQs72/NXAGsx77pRzH10w+stTcs5n DK72jPnnreMp555CxcFifcrgvkDVBxpK54Jeshi70tH+d6FK3d7Pdhi9iXg1xkEdNJFx lQbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=+foyy/rOZ2kCoEyy18HK4FOE6DdDhrZunk3JubF8Orw=; b=YpFnreCINgIi7WPYWZg+zT6p3SdcLp9WM2K1iI1HxiKRioffZGRIPmt7LmIfAVmWYj 0k43+4k+OpvFZsPnsLsXUM0lrvt9b/85yiJmXVDjJY/CkNS7J9IkRGfsaviPjdZvkJtJ csi51YAni6dismNZ476vws5LQeczWYAJYNw0O++X/4IMxyox6iGLkESVtkrh+VjlRvcV poxcM9VUEi0mroXYP5mPtUbs29buCK8TPoaIa94LaxsG92GBbXTZAs4FhuwJ8o/z70FQ q85nwgCej82hWfLy9tYxGgkCw5aASmfX9v2MRs2T2nXXHnN5r7Ylm/ppzPqQEp2g0yS6 M5BQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y15-v6si7654675pgv.69.2018.05.14.10.26.43; Mon, 14 May 2018 10:26:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753340AbeENQ0f (ORCPT + 99 others); Mon, 14 May 2018 12:26:35 -0400 Received: from bmailout1.hostsharing.net ([83.223.95.100]:42557 "EHLO bmailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753168AbeENQ0W (ORCPT ); Mon, 14 May 2018 12:26:22 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id F071B30000F30; Mon, 14 May 2018 18:26:20 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id B1F7F7879A; Mon, 14 May 2018 18:26:20 +0200 (CEST) Date: Mon, 14 May 2018 18:26:20 +0200 From: Lukas Wunner To: Andy Shevchenko Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Ard Biesheuvel , linux-efi@vger.kernel.org, Sakari Ailus , Mika Westerberg , "Rafael J . Wysocki" , ACPI Devel Maling List Subject: Re: [PATCH v2] device property: Get rid of union aliasing Message-ID: <20180514162620.GA12132@wunner.de> References: <20180508131547.44366-1-andriy.shevchenko@linux.intel.com> <20180514121817.GA27869@wunner.de> <20180514154017.GA6734@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 14, 2018 at 07:13:24PM +0300, Andy Shevchenko wrote: > On Mon, 2018-05-14 at 17:40 +0200, Lukas Wunner wrote: > > On Mon, May 14, 2018 at 03:48:09PM +0300, Andy Shevchenko wrote: > > > On Mon, 2018-05-14 at 14:18 +0200, Lukas Wunner wrote: > > > > On Tue, May 08, 2018 at 04:15:47PM +0300, Andy Shevchenko wrote: > > > > > --- a/drivers/firmware/efi/apple-properties.c > > > > > +++ b/drivers/firmware/efi/apple-properties.c > > > > > @@ -13,6 +13,9 @@ > > > > > + * FIXME: The approach is still based on union aliasing and > > > > > should be > > > > > + * replaced by a proper resource provider. > > > > > > > > Why? All Apple EFI properties are either boolean or u8 arrays. > > > > You've correctly changed this file to always supply u8 arrays, > > > > so I don't see where union aliasing is happening here? > > > > > > the implementation is quite fragile in this sense, because it > > > doesn't discourage people to use device_property_read_string() in > > > case when it's indeed a string (I saw these kind of properties in > > > the very dump you posted on your GH page). > > > > Well if that is your concern then you need to prevent functions which > > retrieve properties to use the wrong type. > > > > E.g. to prevent retrieval of the u8 array as string, you'd have to > > amend drivers/base/property.c:pset_prop_read_string_array() to > > check the type of the property found and return -EINVAL if it's not > > string. > > I think it's doable. I will hack a new version later this week. Ok, thanks for doing this. > But it still not a (best) solution for Apple properties. B/c as I told > already I saw in _your_ dump the _string_ properties. Someone might have > got an idea to use them as _strings_. That's kind of their problem then. ;-) The Apple EFI properties are untyped, so making them available as u8 arrays is the best we can do. If people need them as strings, they should retrieve as u8 array and convert that to string themselves. Kind regards, Lukas