Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4636888imm; Mon, 14 May 2018 10:19:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo2xfCBhtv3YfiT2QZl0xp8D6ThFOalzIQptgvmKRSgJ4hWy0H313GwtBNtqZQKGaarP0ZD X-Received: by 2002:a17:902:8b82:: with SMTP id ay2-v6mr10651842plb.295.1526318387151; Mon, 14 May 2018 10:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526318387; cv=none; d=google.com; s=arc-20160816; b=Y5VkFhnLMu4He6aZ3vnxUznjAJ9I/SAgDORJhHtEuLkoUdQvW8FyyRl1gxjwDMO2CF AayXKdfG/MIlJaJxoN9THHEiBeBkc3K3h7LYQwJ+HHgZcbEiH5+qQapd9qSJpgG1Xs/d sNa+Oai9Pn6JFIxc7eGRvZh/7ocmjDXsceUCfX/aTNCUDhHLI1ICiDoGK85rK+8S8YDh RWd3kJJ2cuIooJ2LO+XulUrdFmKbQrrabl1E+GKp2iOALnEsybV20ay7VgWBBQuQhO6y MbpTWHWgz0kURdZRWWN9YdPT6ECCEHNbBS93qEKNz49mI+Ra18wRyRxCupxwdPa+dxvg OpJw== 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=e54tljYzgdV6XLsBfc9I8f9+0AYukEcFkDUIMmfwF2w=; b=xR6CMSp2saAIdcFPj1bZ/ssCSq07Ai8QtrqN+nr9b4dxzED0eFZrXFCjTj22SigCUq iELi9i7fLIdbI9jezI1MOiyf1w3GazJnMFVVz3XdPF73vr2bC3mdJxDXtchFr0uDJjC2 GJ/jTO5rt1xnsY6z/1Y1txFr4fVlxwbp7905PcTLMVgavICRXH7kz2nTj0YChMaJ0aTS z5NVTV+jXX+o7n3REXkkCpoAArxvIyVav/GgOfiDzMFUK+pGYimoxEKhMVCFYvcGig1O CGQzLQtNqGD+DPLeddBqoi7WRUW0i8iQYa5Z1JUxH+HdJ0r8r3JFXtqG00DW0AdD1ee2 0MIw== 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 i10-v6si7885725pgv.109.2018.05.14.10.19.32; Mon, 14 May 2018 10:19:47 -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 S1754232AbeENPkY (ORCPT + 99 others); Mon, 14 May 2018 11:40:24 -0400 Received: from bmailout3.hostsharing.net ([176.9.242.62]:47231 "EHLO bmailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752590AbeENPkT (ORCPT ); Mon, 14 May 2018 11:40:19 -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 bmailout3.hostsharing.net (Postfix) with ESMTPS id 9E857100E417D; Mon, 14 May 2018 17:40:17 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 31C1077A36; Mon, 14 May 2018 17:40:17 +0200 (CEST) Date: Mon, 14 May 2018 17:40:17 +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: <20180514154017.GA6734@wunner.de> References: <20180508131547.44366-1-andriy.shevchenko@linux.intel.com> <20180514121817.GA27869@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 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? > > Okay, for now I can see only Thunderbolt user of these properties (is it > correct?) in upstream which uses u8 arrays indeed. That is correct, thunderbolt.ko is so far the only user. > Though 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. Thanks, Lukas