From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9BBCC433EF for ; Mon, 20 Jun 2022 15:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243369AbiFTPX7 (ORCPT ); Mon, 20 Jun 2022 11:23:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244698AbiFTPXS (ORCPT ); Mon, 20 Jun 2022 11:23:18 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B7B93A0; Mon, 20 Jun 2022 08:19:19 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id v1so21749417ejg.13; Mon, 20 Jun 2022 08:19:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YWN3Nb8qUtZPtBRLzgiRX4p9myMZxM2UOMateWHK0As=; b=byAC9nol+eee9J9WFHdI7uUDpTHNL5XRs0QLnV1qT1B97rve/lgkuaIi309k/AJTv3 cXxv8zbwfDt57RZNkBY1jyxn3PmRyEK6ISXeh8PFlSmS6jt0CrAies37Mkx9oX3olSSS pHMDuYUv96GQ/HYruIKQrGqaflX8mmpl4ka1YqGMmTNCBsfTSb9kg8JRqnyXDNimOS6o U/ex3gxT/zjRVYJA0UOmJcE7beywnMnau1rQRkwyOHayq+sHoUW8O476yUFw9fJIZqbn RLsJM5sueubEqkWOLbPj8V04RMbDqHg3V1GNdBswqfY4z1dgxuusg8GLde8EnCP6+wIt ulfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YWN3Nb8qUtZPtBRLzgiRX4p9myMZxM2UOMateWHK0As=; b=gF/r/9jyJF4oww3jbLhFafbuwWvVRzZ2K+i7F6FQ6XQuDn7CTUEWxdWJudV2bBtYKF MQsP+XytNAP+K4qXaNqV8XrCvfMy4zjkBzvPCJTJXio9P1xKFbVbYZrZy0xf31lRUM/0 BJdwHW075F83CRheuqu2xvjA9VJwCiXlZf5/kHf8iuQHE2d28lg6Tcu1+fGwfno6aRWt iKhh/UnmfcN6VA3dlIrYMfbhsoinMUlkkEa4NR9s0fO53qUoxqG5TtrEarTM3jNI97SM b2hV/x3yjjmH+ydU8EjHO3HF1t3ah0Mo+KhICT1zwQnDRehsYZ2pZOkZH/6aZTSOF9/z WEdA== X-Gm-Message-State: AJIora9inMR/XRUzDg9gQcIlDE0qe7Q4OQUIDjy7QzK7IE/zagxQPqNd Onsk4Ts6c9tqTZCyZy9ELbrM6s45XqRzJZ6h5Tk= X-Google-Smtp-Source: AGRyM1uS2190/Yx1R95D98KQZlAP7JJU20NU3gNzaby0Kw+eJ7qO7bE8z7pSkhwvy6Uy9brm1yhr38JQPT9FcTLbb14= X-Received: by 2002:a17:906:d9d9:b0:710:f2ae:b455 with SMTP id qk25-20020a170906d9d900b00710f2aeb455mr22001283ejb.77.1655738357899; Mon, 20 Jun 2022 08:19:17 -0700 (PDT) MIME-Version: 1.0 References: <202206191726.wq70mbMK-lkp@intel.com> <20220617144031.2549432-1-alexandr.lobakin@intel.com> <20220620135146.2628908-1-alexandr.lobakin@intel.com> In-Reply-To: <20220620135146.2628908-1-alexandr.lobakin@intel.com> From: Andy Shevchenko Date: Mon, 20 Jun 2022 17:18:40 +0200 Message-ID: Subject: Re: [alobakin:bitops 3/7] block/elevator.c:222:9: sparse: sparse: cast from restricted req_flags_t To: Alexander Lobakin Cc: Arnd Bergmann , Yury Norov , Andy Shevchenko , Mark Rutland , Matt Turner , Brian Cain , Geert Uytterhoeven , Yoshinori Sato , Rich Felker , "David S. Miller" , Kees Cook , "Peter Zijlstra (Intel)" , Marco Elver , Borislav Petkov , Tony Luck , Maciej Fijalkowski , Jesse Brandeburg , Greg Kroah-Hartman , linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k , Linux-SH , Sparc kernel list , Linux-Arch , Linux Kernel Mailing List , kbuild-all@lists.01.org, kernel test robot Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org On Mon, Jun 20, 2022 at 4:48 PM Alexander Lobakin wrote: > > From: kernel test robot > Date: Sun, 19 Jun 2022 17:20:05 +0800 > > Also, could someone please help me with this? I don't get what went > wrong with sparse, it's not even some new code, just moving old > stuff. > > > tree: https://github.com/alobakin/linux bitops > > head: 9bd39b17ce49d350eed93a031e0da6389067013e > > commit: 521611f961a7dda92eefa26e1afd3914c06af64e [3/7] bitops: unify non-atomic bitops prototypes across architectures > > config: mips-randconfig-s031-20220619 (https://download.01.org/0day-ci/archive/20220619/202206191726.wq70mbMK-lkp@intel.com/config) > > compiler: mips64el-linux-gcc (GCC) 11.3.0 > > reproduce: > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # apt-get install sparse > > # sparse version: v0.6.4-30-g92122700-dirty > > # https://github.com/alobakin/linux/commit/521611f961a7dda92eefa26e1afd3914c06af64e > > git remote add alobakin https://github.com/alobakin/linux > > git fetch --no-tags alobakin bitops > > git checkout 521611f961a7dda92eefa26e1afd3914c06af64e > > # save the config file > > mkdir build_dir && cp config build_dir/.config > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash > > > > If you fix the issue, kindly add following tag where applicable > > Reported-by: kernel test robot > > > > > > sparse warnings: (new ones prefixed by >>) > > command-line: note: in included file: > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined > > builtin:0:0: sparse: this was the original definition > > block/elevator.c: note: in included file (through include/linux/bitops.h, include/linux/kernel.h): > > include/asm-generic/bitops/generic-non-atomic.h:29:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:30:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:32:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:32:16: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:27:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:38:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:39:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:41:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:41:16: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:36:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:56:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:57:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:59:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:59:15: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:54:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:74:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:75:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:76:9: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:78:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:78:14: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:78:20: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:79:17: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:79:23: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:79:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:72:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:94:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:95:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:96:9: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:98:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:98:14: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:98:21: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:99:17: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:99:23: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:99:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:92:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:106:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:107:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:108:9: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:110:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:110:14: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:110:20: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:111:17: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:111:23: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:111:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:104:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:127:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:120:1: sparse: sparse: unreplaced symbol 'return' > > >> block/elevator.c:222:9: sparse: sparse: cast from restricted req_flags_t > > > > vim +222 block/elevator.c > > > > 9817064b68fef7 Jens Axboe 2006-07-28 217 > > 70b3ea056f3074 Jens Axboe 2016-12-07 218 void elv_rqhash_add(struct request_queue *q, struct request *rq) > > 9817064b68fef7 Jens Axboe 2006-07-28 219 { > > b374d18a4bfce7 Jens Axboe 2008-10-31 220 struct elevator_queue *e = q->elevator; > > 9817064b68fef7 Jens Axboe 2006-07-28 221 > > 9817064b68fef7 Jens Axboe 2006-07-28 @222 BUG_ON(ELV_ON_HASH(rq)); > > 242d98f077ac0a Sasha Levin 2012-12-17 223 hash_add(e->hash, &rq->hash, rq_hash_key(rq)); > > e806402130c9c4 Christoph Hellwig 2016-10-20 224 rq->rq_flags |= RQF_HASHED; > > 9817064b68fef7 Jens Axboe 2006-07-28 225 } > > bd166ef183c263 Jens Axboe 2017-01-17 226 EXPORT_SYMBOL_GPL(elv_rqhash_add); > > 9817064b68fef7 Jens Axboe 2006-07-28 227 It looks like a false positive for _your_ case, but if you want to fix here is the background. The sparse has an ability to control custom types that should never set bits outside of the limited range. For this the special annotation is given, i.e. __bitwise. Since the culprit type is defined that way it means the pure integer (signed or unsigned) that comes with pure definition can't be used in a safe way. To solve this each of such definitions should be converted to the very same type (req_flags_t). See serial core where some UART flags are defined in a similar way and how code copes with that. -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============6206712927890655705==" MIME-Version: 1.0 From: Andy Shevchenko To: kbuild-all@lists.01.org Subject: Re: [alobakin:bitops 3/7] block/elevator.c:222:9: sparse: sparse: cast from restricted req_flags_t Date: Mon, 20 Jun 2022 17:18:40 +0200 Message-ID: In-Reply-To: <20220620135146.2628908-1-alexandr.lobakin@intel.com> List-Id: --===============6206712927890655705== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Mon, Jun 20, 2022 at 4:48 PM Alexander Lobakin wrote: > > From: kernel test robot > Date: Sun, 19 Jun 2022 17:20:05 +0800 > > Also, could someone please help me with this? I don't get what went > wrong with sparse, it's not even some new code, just moving old > stuff. > > > tree: https://github.com/alobakin/linux bitops > > head: 9bd39b17ce49d350eed93a031e0da6389067013e > > commit: 521611f961a7dda92eefa26e1afd3914c06af64e [3/7] bitops: unify no= n-atomic bitops prototypes across architectures > > config: mips-randconfig-s031-20220619 (https://download.01.org/0day-ci/= archive/20220619/202206191726.wq70mbMK-lkp(a)intel.com/config) > > compiler: mips64el-linux-gcc (GCC) 11.3.0 > > reproduce: > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/s= bin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # apt-get install sparse > > # sparse version: v0.6.4-30-g92122700-dirty > > # https://github.com/alobakin/linux/commit/521611f961a7dda92eef= a26e1afd3914c06af64e > > git remote add alobakin https://github.com/alobakin/linux > > git fetch --no-tags alobakin bitops > > git checkout 521611f961a7dda92eefa26e1afd3914c06af64e > > # save the config file > > mkdir build_dir && cp config build_dir/.config > > COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-11.3.0 make.c= ross C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=3Dbuild_dir ARCH= =3Dmips SHELL=3D/bin/bash > > > > If you fix the issue, kindly add following tag where applicable > > Reported-by: kernel test robot > > > > > > sparse warnings: (new ones prefixed by >>) > > command-line: note: in included file: > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE red= efined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST red= efined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL red= efined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE red= efined > > builtin:0:0: sparse: this was the original definition > > block/elevator.c: note: in included file (through include/linux/bito= ps.h, include/linux/kernel.h): > > include/asm-generic/bitops/generic-non-atomic.h:29:9: sparse: sparse= : unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:30:9: sparse: sparse= : unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:32:10: sparse: spars= e: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:32:16: sparse: spars= e: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:27:1: sparse: sparse= : unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:38:9: sparse: sparse= : unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:39:9: sparse: sparse= : unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:41:10: sparse: spars= e: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:41:16: sparse: spars= e: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:36:1: sparse: sparse= : unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:56:9: sparse: sparse= : unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:57:9: sparse: sparse= : unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:59:10: sparse: spars= e: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:59:15: sparse: spars= e: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:54:1: sparse: sparse= : unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:74:9: sparse: sparse= : unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:75:9: sparse: sparse= : unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:76:9: sparse: sparse= : unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:78:10: sparse: spars= e: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:78:14: sparse: spars= e: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:78:20: sparse: spars= e: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:79:17: sparse: spars= e: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:79:23: sparse: spars= e: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:79:9: sparse: sparse= : unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:72:1: sparse: sparse= : unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:94:9: sparse: sparse= : unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:95:9: sparse: sparse= : unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:96:9: sparse: sparse= : unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:98:10: sparse: spars= e: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:98:14: sparse: spars= e: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:98:21: sparse: spars= e: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:99:17: sparse: spars= e: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:99:23: sparse: spars= e: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:99:9: sparse: sparse= : unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:92:1: sparse: sparse= : unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:106:9: sparse: spars= e: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:107:9: sparse: spars= e: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:108:9: sparse: spars= e: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:110:10: sparse: spar= se: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:110:14: sparse: spar= se: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:110:20: sparse: spar= se: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:111:17: sparse: spar= se: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:111:23: sparse: spar= se: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:111:9: sparse: spars= e: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:104:1: sparse: spars= e: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:127:9: sparse: spars= e: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:120:1: sparse: spars= e: unreplaced symbol 'return' > > >> block/elevator.c:222:9: sparse: sparse: cast from restricted req_fla= gs_t > > > > vim +222 block/elevator.c > > > > 9817064b68fef7 Jens Axboe 2006-07-28 217 > > 70b3ea056f3074 Jens Axboe 2016-12-07 218 void elv_rqhash_add(s= truct request_queue *q, struct request *rq) > > 9817064b68fef7 Jens Axboe 2006-07-28 219 { > > b374d18a4bfce7 Jens Axboe 2008-10-31 220 struct elevator_q= ueue *e =3D q->elevator; > > 9817064b68fef7 Jens Axboe 2006-07-28 221 > > 9817064b68fef7 Jens Axboe 2006-07-28 @222 BUG_ON(ELV_ON_HAS= H(rq)); > > 242d98f077ac0a Sasha Levin 2012-12-17 223 hash_add(e->hash,= &rq->hash, rq_hash_key(rq)); > > e806402130c9c4 Christoph Hellwig 2016-10-20 224 rq->rq_flags |=3D= RQF_HASHED; > > 9817064b68fef7 Jens Axboe 2006-07-28 225 } > > bd166ef183c263 Jens Axboe 2017-01-17 226 EXPORT_SYMBOL_GPL(elv= _rqhash_add); > > 9817064b68fef7 Jens Axboe 2006-07-28 227 It looks like a false positive for _your_ case, but if you want to fix here is the background. The sparse has an ability to control custom types that should never set bits outside of the limited range. For this the special annotation is given, i.e. __bitwise. Since the culprit type is defined that way it means the pure integer (signed or unsigned) that comes with pure definition can't be used in a safe way. To solve this each of such definitions should be converted to the very same type (req_flags_t). See serial core where some UART flags are defined in a similar way and how code copes with that. -- = With Best Regards, Andy Shevchenko --===============6206712927890655705==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Date: Mon, 20 Jun 2022 15:18:40 +0000 Subject: Re: [alobakin:bitops 3/7] block/elevator.c:222:9: sparse: sparse: cast from restricted req_flags_t Message-Id: List-Id: References: <202206191726.wq70mbMK-lkp@intel.com> <20220617144031.2549432-1-alexandr.lobakin@intel.com> <20220620135146.2628908-1-alexandr.lobakin@intel.com> In-Reply-To: <20220620135146.2628908-1-alexandr.lobakin@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alexander Lobakin Cc: Arnd Bergmann , Yury Norov , Andy Shevchenko , Mark Rutland , Matt Turner , Brian Cain , Geert Uytterhoeven , Yoshinori Sato , Rich Felker , "David S. Miller" , Kees Cook , "Peter Zijlstra (Intel)" , Marco Elver , Borislav Petkov , Tony Luck , Maciej Fijalkowski , Jesse Brandeburg , Greg Kroah-Hartman , linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k , Linux-SH , Sparc kernel list , Linux-Arch , Linux Kernel Mailing List , kbuild-all@lists.01.org, kernel test robot On Mon, Jun 20, 2022 at 4:48 PM Alexander Lobakin wrote: > > From: kernel test robot > Date: Sun, 19 Jun 2022 17:20:05 +0800 > > Also, could someone please help me with this? I don't get what went > wrong with sparse, it's not even some new code, just moving old > stuff. > > > tree: https://github.com/alobakin/linux bitops > > head: 9bd39b17ce49d350eed93a031e0da6389067013e > > commit: 521611f961a7dda92eefa26e1afd3914c06af64e [3/7] bitops: unify non-atomic bitops prototypes across architectures > > config: mips-randconfig-s031-20220619 (https://download.01.org/0day-ci/archive/20220619/202206191726.wq70mbMK-lkp@intel.com/config) > > compiler: mips64el-linux-gcc (GCC) 11.3.0 > > reproduce: > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # apt-get install sparse > > # sparse version: v0.6.4-30-g92122700-dirty > > # https://github.com/alobakin/linux/commit/521611f961a7dda92eefa26e1afd3914c06af64e > > git remote add alobakin https://github.com/alobakin/linux > > git fetch --no-tags alobakin bitops > > git checkout 521611f961a7dda92eefa26e1afd3914c06af64e > > # save the config file > > mkdir build_dir && cp config build_dir/.config > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash > > > > If you fix the issue, kindly add following tag where applicable > > Reported-by: kernel test robot > > > > > > sparse warnings: (new ones prefixed by >>) > > command-line: note: in included file: > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined > > builtin:0:0: sparse: this was the original definition > > block/elevator.c: note: in included file (through include/linux/bitops.h, include/linux/kernel.h): > > include/asm-generic/bitops/generic-non-atomic.h:29:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:30:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:32:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:32:16: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:27:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:38:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:39:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:41:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:41:16: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:36:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:56:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:57:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:59:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:59:15: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:54:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:74:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:75:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:76:9: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:78:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:78:14: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:78:20: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:79:17: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:79:23: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:79:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:72:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:94:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:95:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:96:9: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:98:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:98:14: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:98:21: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:99:17: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:99:23: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:99:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:92:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:106:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:107:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:108:9: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:110:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:110:14: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:110:20: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:111:17: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:111:23: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:111:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:104:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:127:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:120:1: sparse: sparse: unreplaced symbol 'return' > > >> block/elevator.c:222:9: sparse: sparse: cast from restricted req_flags_t > > > > vim +222 block/elevator.c > > > > 9817064b68fef7 Jens Axboe 2006-07-28 217 > > 70b3ea056f3074 Jens Axboe 2016-12-07 218 void elv_rqhash_add(struct request_queue *q, struct request *rq) > > 9817064b68fef7 Jens Axboe 2006-07-28 219 { > > b374d18a4bfce7 Jens Axboe 2008-10-31 220 struct elevator_queue *e = q->elevator; > > 9817064b68fef7 Jens Axboe 2006-07-28 221 > > 9817064b68fef7 Jens Axboe 2006-07-28 @222 BUG_ON(ELV_ON_HASH(rq)); > > 242d98f077ac0a Sasha Levin 2012-12-17 223 hash_add(e->hash, &rq->hash, rq_hash_key(rq)); > > e806402130c9c4 Christoph Hellwig 2016-10-20 224 rq->rq_flags |= RQF_HASHED; > > 9817064b68fef7 Jens Axboe 2006-07-28 225 } > > bd166ef183c263 Jens Axboe 2017-01-17 226 EXPORT_SYMBOL_GPL(elv_rqhash_add); > > 9817064b68fef7 Jens Axboe 2006-07-28 227 It looks like a false positive for _your_ case, but if you want to fix here is the background. The sparse has an ability to control custom types that should never set bits outside of the limited range. For this the special annotation is given, i.e. __bitwise. Since the culprit type is defined that way it means the pure integer (signed or unsigned) that comes with pure definition can't be used in a safe way. To solve this each of such definitions should be converted to the very same type (req_flags_t). See serial core where some UART flags are defined in a similar way and how code copes with that. -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Subject: Re: [alobakin:bitops 3/7] block/elevator.c:222:9: sparse: sparse: cast from restricted req_flags_t Date: Mon, 20 Jun 2022 17:18:40 +0200 Message-ID: References: <202206191726.wq70mbMK-lkp@intel.com> <20220617144031.2549432-1-alexandr.lobakin@intel.com> <20220620135146.2628908-1-alexandr.lobakin@intel.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YWN3Nb8qUtZPtBRLzgiRX4p9myMZxM2UOMateWHK0As=; b=byAC9nol+eee9J9WFHdI7uUDpTHNL5XRs0QLnV1qT1B97rve/lgkuaIi309k/AJTv3 cXxv8zbwfDt57RZNkBY1jyxn3PmRyEK6ISXeh8PFlSmS6jt0CrAies37Mkx9oX3olSSS pHMDuYUv96GQ/HYruIKQrGqaflX8mmpl4ka1YqGMmTNCBsfTSb9kg8JRqnyXDNimOS6o U/ex3gxT/zjRVYJA0UOmJcE7beywnMnau1rQRkwyOHayq+sHoUW8O476yUFw9fJIZqbn RLsJM5sueubEqkWOLbPj8V04RMbDqHg3V1GNdBswqfY4z1dgxuusg8GLde8EnCP6+wIt ulfA== In-Reply-To: <20220620135146.2628908-1-alexandr.lobakin@intel.com> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alexander Lobakin Cc: Arnd Bergmann , Yury Norov , Andy Shevchenko , Mark Rutland , Matt Turner , Brian Cain , Geert Uytterhoeven , Yoshinori Sato , Rich Felker , "David S. Miller" , Kees Cook , "Peter Zijlstra (Intel)" , Marco Elver , Borislav Petkov , Tony Luck , Maciej Fijalkowski , Jesse Brandeburg , Greg Kroah-Hartman , linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org On Mon, Jun 20, 2022 at 4:48 PM Alexander Lobakin wrote: > > From: kernel test robot > Date: Sun, 19 Jun 2022 17:20:05 +0800 > > Also, could someone please help me with this? I don't get what went > wrong with sparse, it's not even some new code, just moving old > stuff. > > > tree: https://github.com/alobakin/linux bitops > > head: 9bd39b17ce49d350eed93a031e0da6389067013e > > commit: 521611f961a7dda92eefa26e1afd3914c06af64e [3/7] bitops: unify non-atomic bitops prototypes across architectures > > config: mips-randconfig-s031-20220619 (https://download.01.org/0day-ci/archive/20220619/202206191726.wq70mbMK-lkp@intel.com/config) > > compiler: mips64el-linux-gcc (GCC) 11.3.0 > > reproduce: > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # apt-get install sparse > > # sparse version: v0.6.4-30-g92122700-dirty > > # https://github.com/alobakin/linux/commit/521611f961a7dda92eefa26e1afd3914c06af64e > > git remote add alobakin https://github.com/alobakin/linux > > git fetch --no-tags alobakin bitops > > git checkout 521611f961a7dda92eefa26e1afd3914c06af64e > > # save the config file > > mkdir build_dir && cp config build_dir/.config > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash > > > > If you fix the issue, kindly add following tag where applicable > > Reported-by: kernel test robot > > > > > > sparse warnings: (new ones prefixed by >>) > > command-line: note: in included file: > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined > > builtin:0:0: sparse: this was the original definition > > builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined > > builtin:0:0: sparse: this was the original definition > > block/elevator.c: note: in included file (through include/linux/bitops.h, include/linux/kernel.h): > > include/asm-generic/bitops/generic-non-atomic.h:29:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:30:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:32:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:32:16: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:27:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:38:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:39:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:41:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:41:16: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:36:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:56:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:57:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:59:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:59:15: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:54:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:74:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:75:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:76:9: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:78:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:78:14: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:78:20: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:79:17: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:79:23: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:79:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:72:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:94:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:95:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:96:9: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:98:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:98:14: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:98:21: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:99:17: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:99:23: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:99:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:92:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:106:9: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:107:9: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:108:9: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:110:10: sparse: sparse: unreplaced symbol 'p' > > include/asm-generic/bitops/generic-non-atomic.h:110:14: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:110:20: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:111:17: sparse: sparse: unreplaced symbol 'old' > > include/asm-generic/bitops/generic-non-atomic.h:111:23: sparse: sparse: unreplaced symbol 'mask' > > include/asm-generic/bitops/generic-non-atomic.h:111:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:104:1: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:127:9: sparse: sparse: unreplaced symbol 'return' > > include/asm-generic/bitops/generic-non-atomic.h:120:1: sparse: sparse: unreplaced symbol 'return' > > >> block/elevator.c:222:9: sparse: sparse: cast from restricted req_flags_t > > > > vim +222 block/elevator.c > > > > 9817064b68fef7 Jens Axboe 2006-07-28 217 > > 70b3ea056f3074 Jens Axboe 2016-12-07 218 void elv_rqhash_add(struct request_queue *q, struct request *rq) > > 9817064b68fef7 Jens Axboe 2006-07-28 219 { > > b374d18a4bfce7 Jens Axboe 2008-10-31 220 struct elevator_queue *e = q->elevator; > > 9817064b68fef7 Jens Axboe 2006-07-28 221 > > 9817064b68fef7 Jens Axboe 2006-07-28 @222 BUG_ON(ELV_ON_HASH(rq)); > > 242d98f077ac0a Sasha Levin 2012-12-17 223 hash_add(e->hash, &rq->hash, rq_hash_key(rq)); > > e806402130c9c4 Christoph Hellwig 2016-10-20 224 rq->rq_flags |= RQF_HASHED; > > 9817064b68fef7 Jens Axboe 2006-07-28 225 } > > bd166ef183c263 Jens Axboe 2017-01-17 226 EXPORT_SYMBOL_GPL(elv_rqhash_add); > > 9817064b68fef7 Jens Axboe 2006-07-28 227 It looks like a false positive for _your_ case, but if you want to fix here is the background. The sparse has an ability to control custom types that should never set bits outside of the limited range. For this the special annotation is given, i.e. __bitwise. Since the culprit type is defined that way it means the pure integer (signed or unsigned) that comes with pure definition can't be used in a safe way. To solve this each of such definitions should be converted to the very same type (req_flags_t). See serial core where some UART flags are defined in a similar way and how code copes with that. -- With Best Regards, Andy Shevchenko