Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4283545rwo; Tue, 25 Jul 2023 03:52:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlFfAPMVWjRpvMZt6HD+3Gs03hF7nTHDVsOQJCp1X9DlfX95MowgcvI+fZGry93bdwBA0Zig X-Received: by 2002:a54:4001:0:b0:3a4:67b6:454e with SMTP id x1-20020a544001000000b003a467b6454emr11904929oie.6.1690282338095; Tue, 25 Jul 2023 03:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690282338; cv=none; d=google.com; s=arc-20160816; b=y79rxZdu91wFVEjqvmSm2rrIudoiJ8WR5Yu8/8gyoCrfYxr6/hkm45bE41ubbAhC2B uB9kPyUUT5qzKSxroPzmssKucK9bIuoEf8TPWmv6lJANcMsEnMEsu/+F3ADG/6Fsrj4a 8m7m7YZgGwWEvu2mirRgloX0eqrEQTDZb4tYYBvbhgvH8o4ZBRJVcKo0iNaA+obh7ZA6 y4EyJ+UwoolXQyDIACmiRxLo+Dll/xjyJnxV9hEoBDk9B/Z7GBjEF1Y10wZwAbEeXm/v XhIee4txyNhMWTVYTNyWtTRGVOekgUHjr3MU29BzhQqx2X7j+7FSoiCpDMcvHvneCIlP xVkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:message-id:date:thread-index :thread-topic:subject:to:from; bh=rQGfHQTSGqPe1BPh3lU/MRurhVdFtyeZy4BwRI8rBZA=; fh=6LDawf1JAWamBn08sBajPnNnIEu8LybObHHZW9kFGho=; b=McJe2ey8T9w7gxD9mgjp5OR1JWKppkBvwWOHh9K+42y16iuX780U6yoNNLhj5UTTiD Ez+vI/uxCglmQ2HP4TqX+uSZDmOh8DWPDlBQtGdI/npinfwheuFJkb/BbatNNJy/1Ly8 lW5TTTaZ7lpkhhW4XSpVR4kYQcLMfVkhdQVRaF79uV9VCy9/WVlopwgEh67ql1T502XD SeIvwygZ4TX3lSA17gXPZaVLYcxCkgZBMfNCtMkJ8jHodaMBEx1kSiGDfiSy70jMxP0h 8yBmT4ItFflzcO/dmiwbc2C46eqjJs/6Z7HcW5U1gCSu6OokAZ2yNNymBRqJziy6uh/l /3EQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a654145000000b0055be9543340si11014204pgp.872.2023.07.25.03.52.05; Tue, 25 Jul 2023 03:52:18 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233032AbjGYKBd convert rfc822-to-8bit (ORCPT + 99 others); Tue, 25 Jul 2023 06:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232456AbjGYKBD (ORCPT ); Tue, 25 Jul 2023 06:01:03 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ED4310CC for ; Tue, 25 Jul 2023 03:01:01 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-106-t_-S1qfXMXC8FYvyIudf1w-1; Tue, 25 Jul 2023 11:00:59 +0100 X-MC-Unique: t_-S1qfXMXC8FYvyIudf1w-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 25 Jul 2023 11:00:58 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Tue, 25 Jul 2023 11:00:58 +0100 From: David Laight To: "linux-kernel@vger.kernel.org" , "'Andy Shevchenko'" , 'Andrew Morton' , "Matthew Wilcox (Oracle)" , Christoph Hellwig , "Jason A. Donenfeld" Subject: [PATCH next 4/5] minmax: Allow comparisons of 'int' against 'unsigned char/short'. Thread-Topic: [PATCH next 4/5] minmax: Allow comparisons of 'int' against 'unsigned char/short'. Thread-Index: Adm+2sjvX0bUWWzzTwubPg2+xZ3MuA== Date: Tue, 25 Jul 2023 10:00:57 +0000 Message-ID: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Since 'unsigned char/short' get promoted to 'signed int' it is safe to compare them against an 'int' value. Signed-off-by: David Laight --- include/linux/minmax.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/minmax.h b/include/linux/minmax.h index 179034479d5e..baffbe5c855d 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.h @@ -16,7 +16,8 @@ * allocation usage). */ #define __types_ok(x, y) \ - (is_signed_type(typeof(x)) == is_signed_type(typeof(y))) + (is_signed_type(typeof(x)) == is_signed_type(typeof(y)) || \ + is_signed_type(typeof((x) + 0)) == is_signed_type(typeof((y) + 0))) #define __cmp_op_min < #define __cmp_op_max > -- 2.17.1 - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)