Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1404967rwb; Fri, 28 Jul 2023 08:59:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlHp0Y1xlchUEyg+RH5qDdN/kx8JN+GGUbIKsCTVsm3zdfeDijdHx7B5N9cBUa+DO+ycmVuS X-Received: by 2002:a17:90b:3645:b0:268:7b9b:f23e with SMTP id nh5-20020a17090b364500b002687b9bf23emr1708689pjb.24.1690559968962; Fri, 28 Jul 2023 08:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690559968; cv=none; d=google.com; s=arc-20160816; b=uioQQ1i+faZkKjc8t8vsYvEe9pWr/IsOVkaNho4rEbwPvH450sTclp0c+mcepg5GY/ zHNZV9Ii+7Xu0f7LDstCp+MhneJxZVEqi3V6NBpnb1FnyKURwG3IBy9Asv5lTT/oCKXB IurK2aPRfW9tQvhr4ATCx3e2Ba4HtX1LQmAUGeIIJbF2/M+JhK3xXgmifxv0UKWeJuNl QA7SEsnZRN5kXz7mJxuTMiU7UO4WwonnnoM2yQJhEx3Uso2JD6LzPrNmHRB171uTI05I UZ+MW6nJ29uUzlBJ8HuoxoTvANIPXI4q2nSuYq+n11k0VyN2HPJK029uO8JCkCBu6gXW GlaA== 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:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:to:from; bh=iaaCzc6Q9i6O/CVRA6Hi/kM6L9NyFKotzDsqlMeuki8=; fh=lQu0FQMQB/KijsOLYPBSZ4oPXp6gJVSgtvs90PKCM00=; b=y1fhti8UV/AmeQXDfVnbuaILw5I9KJ3GLptUF6ppWTMiR+FQwKpsksemoeq2HNw2/a NrzaGLDHOyPbS78992V3qA4sZEVwRxPvBREg9gER/qjtZRPnJ/JibOBLf1z+xsYjLSrD fAwTI0gYX6t9SScgljndflN0/OaCsyuU4PRGpA+iaxEj7APjmgb1IGUtBlmx8dFlce1B GHWSpppsbjB7/9JqgrR3SmDnZI3BQ4IK+ExpaBou0A7OhJbtak9NQPJXrvEPGhm6080d o9Gz2gXWeemASAyHsJ2u7sRK4mnue2MESMDRQNrixTfa7T5loVlai1/lNa/mtnsPvSVP Jsag== 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 y11-20020a17090a86cb00b00263f3eb229fsi4742395pjv.47.2023.07.28.08.59.16; Fri, 28 Jul 2023 08:59:28 -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 S236628AbjG1Owz convert rfc822-to-8bit (ORCPT + 99 others); Fri, 28 Jul 2023 10:52:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjG1Owy (ORCPT ); Fri, 28 Jul 2023 10:52:54 -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 8262BCE for ; Fri, 28 Jul 2023 07:52:53 -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-236-Fp2cxm8lMJC0BQqv7saK6A-1; Fri, 28 Jul 2023 15:52:50 +0100 X-MC-Unique: Fp2cxm8lMJC0BQqv7saK6A-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Fri, 28 Jul 2023 15:52:49 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Fri, 28 Jul 2023 15:52:49 +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 v2 4/5] minmax: Allow comparisons of 'int' against 'unsigned char/short'. Thread-Topic: [PATCH next v2 4/5] minmax: Allow comparisons of 'int' against 'unsigned char/short'. Thread-Index: AdnBYyrMGD35ZuQNSpqtqF8DHKMGsw== Date: Fri, 28 Jul 2023 14:52:49 +0000 Message-ID: <34492660a17e44c19a98c4f0f37f6320@AcuMS.aculab.com> References: In-Reply-To: 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_NONE, 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 --- v2: No change 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 4c77ac9ed284..7d3ad9cbbff6 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.h @@ -20,7 +20,8 @@ (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) #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)