Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp361653rwe; Thu, 25 Aug 2022 01:25:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Q5MpV1DJWcpZZfvuJfPsaqZup1RFmhQ8lCVPYiDP/ROFnHkSFJLNo8mc//8dSGKlk2kgF X-Received: by 2002:a17:903:110e:b0:171:3afa:e68c with SMTP id n14-20020a170903110e00b001713afae68cmr2724292plh.12.1661415942930; Thu, 25 Aug 2022 01:25:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661415942; cv=none; d=google.com; s=arc-20160816; b=KjTyWP4iz7jb0mCsc68YfZG+aYgA+Oq27YxFgNGlmMl6lRwQbzsShiz/w22HTeHPwZ Rb3b2Ag1c0Qbw8XcgMaVHPp1zjG/PGyUhbn/kYFUuBkWPsz/XGedy+kEutyq1aKmN4J1 266haymMljDmysvPeocpo4KITSBk1iq42h8u0slrM5kVH93aD7cb7ZtEz5hQRrTc2Bat ZFv/ZyKWAyJAE1FkwWHBHm0u+2HytJdgIOd4wVNCORhqzTyL4MvdQU4Y5Noa44YqUk4t WMo4iAQnzPf73kY6y3qs6hoxnvcqwA69De1+cG+t0oPdAro7erQMNjxCeYYy+rdWPmVE v1Bw== 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=xFlu0i7Pw8rPXcXmIXdxueKTfKrGHV4MSH+Vl7gTWgA=; b=rfvGMn7MuSKsXs0T6gbWLneszrIVIaopfUJQuYd01zsddMH/JOZ9OuKwFvHWtCSG0R Wj6KbL/xDnO+ldE46YQTd05D81AismQyX62035eqd04XnmWcrGEhhNq8SsBn1LVRx5Ng ADoSTIAP7gY/D5hclQyk58SDAZO/x6Q9I5T6+sMfONGhVFahhdo86g4nb71ItXWSa5Sm PUQEaewEldZzqoJqTt/Gx54apUofmbPfijbeoChj7vHL2QCXCcAFtFrtvIXEpI2KdhR5 4hq1AuB/NJb5szhjdcVEBKX5Bt0TzknRKi4PyJQVRd6bYROJQZOj5vAjVBvThf5jdJZB pUGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Muf2fMGd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a71-20020a63904a000000b00428bf8b4c1asi446712pge.230.2022.08.25.01.25.32; Thu, 25 Aug 2022 01:25:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Muf2fMGd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235219AbiHYHpi (ORCPT + 99 others); Thu, 25 Aug 2022 03:45:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238515AbiHYHpQ (ORCPT ); Thu, 25 Aug 2022 03:45:16 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED6BDA2DA1; Thu, 25 Aug 2022 00:45:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661413511; x=1692949511; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Sl6ubljrae41HflpL13HoTVWCPjIUWo7xLVS3fMd/JM=; b=Muf2fMGd2AR0d90hrJxLPfPR7Ldd7isDKfpbDQMpNEQmeTTLKU0WQANF +inG2mKno+yZHlSvVo4FhYAQIQ0JXkIMP0n5J5QvL2wcvNO8QBmdI050H XcjLS+ItJZDJlVKfOm6Fpxl34XOpXmEGdqlLQ05jMuTZOtpFVpR18N8hj pmBa0Nwfw3PQCK6WEVntDR6abrqOxpqAbNHRwG8TzF3tmJ5r4Ff514EmK pWM6Y7aHNfrqyd4HpfjLdqwFiGV/HmB+aysm+FIpG7r/BSMJjh3rTkZSn Rb2xwdBgF14sX1j0KDOPfA3QpVDZ+eL0mEcB2BLnvpvWlt0EqTIRANmIi g==; X-IronPort-AV: E=McAfee;i="6500,9779,10449"; a="291741736" X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="291741736" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 00:45:10 -0700 X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="560926021" Received: from punajuuri.fi.intel.com (HELO paasikivi.fi.intel.com) ([10.237.72.43]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 00:45:08 -0700 Received: from paasikivi.fi.intel.com (localhost [127.0.0.1]) by paasikivi.fi.intel.com (Postfix) with SMTP id 307252029D; Thu, 25 Aug 2022 10:45:06 +0300 (EEST) Date: Thu, 25 Aug 2022 07:45:06 +0000 From: Sakari Ailus To: Ard Biesheuvel Cc: sbinding@opensource.cirrus.com, andriy.shevchenko@intel.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com, rafael@kernel.org Subject: Re: [PATCH v1] ACPI: Property: Fix type detection of unified integer reading functions Message-ID: References: <20220812130645.14710-1-sbinding@opensource.cirrus.com> <20220825072505.316002-1-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220825072505.316002-1-ardb@kernel.org> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ard, On Thu, Aug 25, 2022 at 09:25:05AM +0200, Ard Biesheuvel wrote: > > The current code expects the type of the value to be an integer type, > > instead the value passed to the macro is a pointer. > > Ensure the size comparison uses the correct pointer type to choose the > > max value, instead of using the integer type. > > > > Fixes: 923044133367 ("ACPI: property: Unify integer value reading functions") > > > > Signed-off-by: Stefan Binding > > Acked-by: Ard Biesheuvel > > Can we get this queued up and sent out please? This is breaking some ACPI arm64 > systems, which use device properties for their MAC addresses. > > Some grumbling about the original patch below. > > > --- > > drivers/acpi/property.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c > > index 7b3ad8ed2f4e..b1d4a8db89df 100644 > > --- a/drivers/acpi/property.c > > +++ b/drivers/acpi/property.c > > @@ -1043,10 +1043,10 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data, > > break; \ > > } \ > > if (__items[i].integer.value > _Generic(__val, \ > > - u8: U8_MAX, \ > > - u16: U16_MAX, \ > > - u32: U32_MAX, \ > > - u64: U64_MAX, \ > > + u8 *: U8_MAX, \ > > + u16 *: U16_MAX, \ > > + u32 *: U32_MAX, \ > > + u64 *: U64_MAX, \ > > default: 0U)) { \ > > Why is there a default here? Having one is what hides the fact that the patch was completely broken. I think the default can be removed. I can send a patch. > > > ret = -EOVERFLOW; \ > > break; \ > > > > Also, I must ask: given how broken the original patch is, I suppose no testing whatsoever was done? Testing was done but it failed to uncover this. It seems all the properties in the system were of buffer type. Please wrap your lines before 80. It'll be easier to read that way. -- Kind regards, Sakari Ailus