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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3612BC5475B for ; Fri, 1 Mar 2024 18:25:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 771146B0098; Fri, 1 Mar 2024 13:25:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 720956B009B; Fri, 1 Mar 2024 13:25:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59BAD6B009C; Fri, 1 Mar 2024 13:25:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 449096B0098 for ; Fri, 1 Mar 2024 13:25:45 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EE6F340449 for ; Fri, 1 Mar 2024 18:25:44 +0000 (UTC) X-FDA: 81849298608.30.9797800 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) by imf14.hostedemail.com (Postfix) with ESMTP id 5D423100012 for ; Fri, 1 Mar 2024 18:25:41 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OX4BU1CD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of sinquersw@gmail.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=sinquersw@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709317541; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nrk65MH7pfEevCRFsfLz97DcqJihUhM5ZATRWMm6nIQ=; b=ulaXyWvawV1UxuJ8YNvj3qk7JDSciXHZuu5Ezfpr28sRi2Vt82L7Bat0P+OIqVt97TecsR MIo0LKQZpDExLGX1uKGo8EYpbjsPuElzA1+YyhCG9qycqp4veOy6ylYAgujQG5ERQjs0Dx 5A0g5qxKGonXSj+zRGkWZnOIPr7eX7E= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OX4BU1CD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of sinquersw@gmail.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=sinquersw@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709317541; a=rsa-sha256; cv=none; b=IAiokSNuT8aAIsKbNVNaXQAgovh2jtOWN9tMhp6NZIKKvfhQ6Pn8W8P30IVTaE794fPTyj HySxxPv8OlxCW8YlD8i/wi6IKveDsUvE/voQnvKE3BASvVGgsA/YABQN5NGwjo61K0fUma PPnIlEnMswnaLjB7sSwYJYXYxjtWfJw= Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-608342633b8so24805417b3.1 for ; Fri, 01 Mar 2024 10:25:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709317540; x=1709922340; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=nrk65MH7pfEevCRFsfLz97DcqJihUhM5ZATRWMm6nIQ=; b=OX4BU1CDJRePce0C0jiRpNf1DDSr4W4McjSXu8UBpiBJU/ajaV1Z1SzBMggYVcnjZD EppT6lbsmp4BTZ3lYfT33uz/RUrMIE1IVLNKEuw3T0sdQNEQjkVDbGYrla+BuRkZK03j HkeZ0iFkL1ZgyBAF8OhQVccseMijdvQ77inCViR5lEDsSKDbdkI3SN9ze+sYctEo+/J2 KbDeZ2uvOFLjuoB2BP94YvPOtKzUYrVBWC+RjtJva+QAUDtExB6wDoVNWu4uXk7VdLAU viIU7Hk7yukv8C5llVQGrb2GTfbWVbT7E0DLH3iIpC9u7pEAQatc0cmyUuCPCuSDg1sB b0BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709317540; x=1709922340; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nrk65MH7pfEevCRFsfLz97DcqJihUhM5ZATRWMm6nIQ=; b=iri2KosNQE0kSEJWpXDWVvOhBpbIGr2eIiBptqkkkHSA+Gv5l1YnaEQZZfDwGQo0m2 wU2x6LwEcciqJfxpSBOquV0Eyh5AGbw8hMBMaYVQGDr6znhqo92IN7dX6xAwEfoRVnAQ el0Ae4ZBNV9Wcmg5MtksU0SrKdUk/BY7/UrTCRI7dgCDSyH05/gU9S6k4X8Cvotx40n0 65BjnvdU2SV2asgpaSTtlztPF5VDBLlHKrKoPRsGBshGMuP+NlF4QDbKCIUHCc4fKAs1 j3ryTgXoJsEG9xMVH5PDb8+6BDvtyUjNlvbaiHo+PrA/Q8JZHMGjxg3feXPRIqG2lwut vMHg== X-Forwarded-Encrypted: i=1; AJvYcCVU4FTFIpVHVIFSBXzc4kTVV/uH7vJgy8aPI6iJu2ymqkRGfZDHOh5f5AjVyuiYQYrsFzVqst7wY8x01G5tXUmXH/Q= X-Gm-Message-State: AOJu0Yw0ls6KBAYRPEz7/1EEI9Q57p8xZ9v6qzpQPxiFuGOdXO4MWsKU ORwF2AzpLONB0FIyLpFcc26lWzC2+HDix54+toj2bungDM5qInUR X-Google-Smtp-Source: AGHT+IEytOJb7kL3IovCZmsaR8o6/2FEpBd1nKwb/AwqWMjChPrJasf8WVyTlWDhcW+kCCA9SUf2lQ== X-Received: by 2002:a25:8543:0:b0:dc6:d7b6:cce9 with SMTP id f3-20020a258543000000b00dc6d7b6cce9mr2375324ybn.57.1709317540270; Fri, 01 Mar 2024 10:25:40 -0800 (PST) Received: from ?IPV6:2600:1700:6cf8:1240:997:2bbc:b035:6e36? ([2600:1700:6cf8:1240:997:2bbc:b035:6e36]) by smtp.gmail.com with ESMTPSA id a9-20020a5b0909000000b00dc22f4bf808sm893825ybq.32.2024.03.01.10.25.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Mar 2024 10:25:39 -0800 (PST) Message-ID: <73e0fa99-7dff-4cb9-bfed-fd3368e54542@gmail.com> Date: Fri, 1 Mar 2024 10:25:38 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [linux-next:master 5519/11156] kernel/bpf/bpf_struct_ops.c:247:16: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_reg_type') Content-Language: en-US To: Thinker Li , kernel test robot Cc: oe-kbuild-all@lists.linux.dev, Linux Memory Management List , Martin KaFai Lau , bpf References: <202403010423.0vNdUDBW-lkp@intel.com> From: Kui-Feng Lee In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5D423100012 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: kpakjott85353i6yfayrui5w7ym5anet X-HE-Tag: 1709317541-658945 X-HE-Meta: U2FsdGVkX1/PrSmG0GJrVF4Xd1QGvk3DA910XiJ7dDBLULkccWuhHZYZZD6pCRcfkhd+n2jN7XLyhA2nbX0emxNQBz8Nmn4os+b3PG0wZRRvftxc9GOHQKnmPJ7ZuNFCnQIyFMSV8uvYXMHTJ92cbW/T5lHJmC8SyvxfJkcMcf4sBBg0TvSiWVDFMWKqXC2uTrDtI5yBEdshB0qY7Edi50ZGmYxbrW/OI9gQJbCkY4+tzSAdRy8FM5r4cuw7bvbcYKJVL/1wxsg/lzZ59tIYy+sQNwsIkqeAsLsrTajuf+vbiMWvTDJuU+jVdXx01AuK1f6boHVHzIo+tZMd6kQf9dXIncYLDHFdF0yoIehvvNV+4eSoYpQd3xvH5cNUyEcqxE7xpWx7jkwaK7jp44TrE44+uMQNW71Z3bjNvjetNXJBRm0S+ty0tl+/b4+bjzSBHKWcpm0/GkUJJ32gRl0pxPyNpoDD9K8c7qg3Imr0qTY7TGq2KEvYfykqV4+PUfAHEmip/S5o0rKAb5GtlBWrWsCnQvWrw3Lek/tUHJnNfXq1owybXigT2rxdreqUeljC7d8msn0hY4Ej3N47SkS71BIjsCUuWxh0hdU7vsVh76ra0SNDUCPJuUV7dvY4VJPOCKNFYLeJSld/E0klNPqooeIJuPIBO6obWYHyZUQ+oUEIIx9ulmkqyYhAApqgjqG+kX9RJn1ZMOVRLP/O24kpenJiuRHudcfv4SLXFHQzgLCLDQmj6ZBiN6a760oVEAUhJ7zTDnZ3jywkugR5pkXfBaVhgCV2d+58ZhcuY/d5C3ZXP67zEFwgMSUVq8r71b2L5KO0Zgpm0VobyFpQQsiRQwBjusv2xDIVg8fghrdLyuYEgcjd/ZeO8T1oXRt+Gjd0Ljf8U0YfP8N2FMa7SP2wPxUnKrDtcSe5ZShu3MnZb4CIeIGKTUx9wK6xBibil8Hdd0hMpn6SYFjmzDDU3Vq VzCEhxR9 AYv7Vx2zN6n5ggJKMBz4T4TdaGcea6ByRV8yuc0tZ7hOhEyPHfwIceVbJNs1vcDx3RGPzXLu2fMEKKwxor61/G3cUWPzpNc/BhE4vmHP3En3VfYyF2m686WU+Ud1Ol0X26E2hm5afqOzTVJT+mir7Nn/dwvhWOU0eDJI4fCEum97u9D8yDvwsZCcrFVy7CKuNEfZT3jr9vAfzqwuBAZvMK8ypb3XOgNvTfDzu0REkZbAomQl5CWc+4FdJw4Ro+X8C5oqbmQecxiHAJYd6YETfZzbOMtseIuGVMh1amEjZlJxZ1srfChGjuZbzTIyzQgoo5tT6K1hvamWEHfEpLiWdnHlf5NPcPBvRFKZSepR1enT8wDc+oMZsSPcvL3i7lDA0h6qPSkzUfikJOa1lQPQ32C2/PLPJVjRt9bAimNWBqTtLugiQozvwVHH1ZB87e9Czgxem+/BFwPnw/lwpJ+AQXx2seQ3Tc/kUOjaNqAwycITLS0h95f+tUmA0mIUuaEMvYy7UU2NEPTXR39/Hu2VnAdQfZlHzDU2JQSauugoZ1WrdJGWxD4ZTcGspdug3TmV/js8Jey7mUaeXKFgoiY4i5ueKz2mxedB4HY8rKVW4e3W4G6xxpucamg5j1aNYd8hk0GWBttS5uqWyW8OpordfVSIUMbzGWIAgJuOMqcn7e98bveW3Hxq/AeUwE6Rla1AmDGpPnR+86X89ADvDXbP7OLxmZBEWGqm7JyC25cvXIoBBOxVwCk9PV7yJ1tOaGZkR6yO1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: For BPF, We have a lot of code mixing bpf_type_flag and bpf_reg_type in bpf. They cause the warning messages described in the message following. Do we want to fix them all, or keep them as they are? They can be fixed by merging two enum types or casting here and there if we want. Any other idea? On 2/29/24 13:07, Thinker Li wrote: > I am checking it. > > On Thu, Feb 29, 2024 at 12:32 PM kernel test robot > wrote: > > tree: > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > master > head:   f303a3e2bcfba900efb5aee55236d17030e9f882 > commit: 1611603537a4b88cec7993f32b70c03113801a46 [5519/11156] bpf: > Create argument information for nullable arguments. > config: s390-randconfig-r133-20240229 > (https://download.01.org/0day-ci/archive/20240301/202403010423.0vNdUDBW-lkp@intel.com/config ) > compiler: clang version 19.0.0git > (https://github.com/llvm/llvm-project > > edd4aee4dd9b5b98b2576a6f783e4086173d902a) > reproduce: > (https://download.01.org/0day-ci/archive/20240301/202403010423.0vNdUDBW-lkp@intel.com/reproduce ) > > If you fix the issue in a separate patch/commit (i.e. not just a new > version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot > > | Closes: > https://lore.kernel.org/oe-kbuild-all/202403010423.0vNdUDBW-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > >          |                                           ~~~~~~~~~~~~~~ > ^ ~~~~~~~~~~~~~~~~~ >    include/linux/bpf.h:778:47: warning: bitwise operation between > different enumeration types ('enum bpf_type_flag' and 'enum > bpf_return_type') [-Wenum-enum-conversion] >      778 |         RET_PTR_TO_TCP_SOCK_OR_NULL     = PTR_MAYBE_NULL > | RET_PTR_TO_TCP_SOCK, >          |                                           ~~~~~~~~~~~~~~ > ^ ~~~~~~~~~~~~~~~~~~~ >    include/linux/bpf.h:779:50: warning: bitwise operation between > different enumeration types ('enum bpf_type_flag' and 'enum > bpf_return_type') [-Wenum-enum-conversion] >      779 |         RET_PTR_TO_SOCK_COMMON_OR_NULL  = PTR_MAYBE_NULL > | RET_PTR_TO_SOCK_COMMON, >          |                                           ~~~~~~~~~~~~~~ > ^ ~~~~~~~~~~~~~~~~~~~~~~ >    include/linux/bpf.h:781:49: warning: bitwise operation between > different enumeration types ('enum bpf_type_flag' and 'enum > bpf_return_type') [-Wenum-enum-conversion] >      781 |         RET_PTR_TO_DYNPTR_MEM_OR_NULL   = PTR_MAYBE_NULL > | RET_PTR_TO_MEM, >          |                                           ~~~~~~~~~~~~~~ > ^ ~~~~~~~~~~~~~~ >    include/linux/bpf.h:782:45: warning: bitwise operation between > different enumeration types ('enum bpf_type_flag' and 'enum > bpf_return_type') [-Wenum-enum-conversion] >      782 |         RET_PTR_TO_BTF_ID_OR_NULL       = PTR_MAYBE_NULL > | RET_PTR_TO_BTF_ID, >          |                                           ~~~~~~~~~~~~~~ > ^ ~~~~~~~~~~~~~~~~~ >    include/linux/bpf.h:783:43: warning: bitwise operation between > different enumeration types ('enum bpf_type_flag' and 'enum > bpf_return_type') [-Wenum-enum-conversion] >      783 |         RET_PTR_TO_BTF_ID_TRUSTED       = PTR_TRUSTED > | RET_PTR_TO_BTF_ID, >          |                                           ~~~~~~~~~~~ > ^ ~~~~~~~~~~~~~~~~~ >    include/linux/bpf.h:894:44: warning: bitwise operation between > different enumeration types ('enum bpf_type_flag' and 'enum > bpf_reg_type') [-Wenum-enum-conversion] >      894 |         PTR_TO_MAP_VALUE_OR_NULL        = PTR_MAYBE_NULL > | PTR_TO_MAP_VALUE, >          |                                           ~~~~~~~~~~~~~~ > ^ ~~~~~~~~~~~~~~~~ >    include/linux/bpf.h:895:42: warning: bitwise operation between > different enumeration types ('enum bpf_type_flag' and 'enum > bpf_reg_type') [-Wenum-enum-conversion] >      895 |         PTR_TO_SOCKET_OR_NULL           = PTR_MAYBE_NULL > | PTR_TO_SOCKET, >          |                                           ~~~~~~~~~~~~~~ > ^ ~~~~~~~~~~~~~ >    include/linux/bpf.h:896:46: warning: bitwise operation between > different enumeration types ('enum bpf_type_flag' and 'enum > bpf_reg_type') [-Wenum-enum-conversion] >      896 |         PTR_TO_SOCK_COMMON_OR_NULL      = PTR_MAYBE_NULL > | PTR_TO_SOCK_COMMON, >          |                                           ~~~~~~~~~~~~~~ > ^ ~~~~~~~~~~~~~~~~~~ >    include/linux/bpf.h:897:44: warning: bitwise operation between > different enumeration types ('enum bpf_type_flag' and 'enum > bpf_reg_type') [-Wenum-enum-conversion] >      897 |         PTR_TO_TCP_SOCK_OR_NULL         = PTR_MAYBE_NULL > | PTR_TO_TCP_SOCK, >          |                                           ~~~~~~~~~~~~~~ > ^ ~~~~~~~~~~~~~~~ >    include/linux/bpf.h:898:42: warning: bitwise operation between > different enumeration types ('enum bpf_type_flag' and 'enum > bpf_reg_type') [-Wenum-enum-conversion] >      898 |         PTR_TO_BTF_ID_OR_NULL           = PTR_MAYBE_NULL > | PTR_TO_BTF_ID, >          |                                           ~~~~~~~~~~~~~~ > ^ ~~~~~~~~~~~~~ >    In file included from kernel/bpf/bpf_struct_ops.c:5: >    In file included from include/linux/bpf_verifier.h:9: >    In file included from include/linux/filter.h:12: >    In file included from include/linux/skbuff.h:28: >    In file included from include/linux/dma-mapping.h:11: >    In file included from include/linux/scatterlist.h:9: >    In file included from arch/s390/include/asm/io.h:78: >    include/asm-generic/io.h:547:31: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      547 |         val = __raw_readb(PCI_IOBASE + addr); >          |                           ~~~~~~~~~~ ^ >    include/asm-generic/io.h:560:61: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      560 |         val = __le16_to_cpu((__le16 > __force)__raw_readw(PCI_IOBASE + addr)); >          | >  ~~~~~~~~~~ ^ >    include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded > from macro '__le16_to_cpu' >       37 | #define __le16_to_cpu(x) __swab16((__force > __u16)(__le16)(x)) >          |                                                           ^ >    include/uapi/linux/swab.h:102:54: note: expanded from macro > '__swab16' >      102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) >          |                                                      ^ >    In file included from kernel/bpf/bpf_struct_ops.c:5: >    In file included from include/linux/bpf_verifier.h:9: >    In file included from include/linux/filter.h:12: >    In file included from include/linux/skbuff.h:28: >    In file included from include/linux/dma-mapping.h:11: >    In file included from include/linux/scatterlist.h:9: >    In file included from arch/s390/include/asm/io.h:78: >    include/asm-generic/io.h:573:61: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      573 |         val = __le32_to_cpu((__le32 > __force)__raw_readl(PCI_IOBASE + addr)); >          | >  ~~~~~~~~~~ ^ >    include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded > from macro '__le32_to_cpu' >       35 | #define __le32_to_cpu(x) __swab32((__force > __u32)(__le32)(x)) >          |                                                           ^ >    include/uapi/linux/swab.h:115:54: note: expanded from macro > '__swab32' >      115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) >          |                                                      ^ >    In file included from kernel/bpf/bpf_struct_ops.c:5: >    In file included from include/linux/bpf_verifier.h:9: >    In file included from include/linux/filter.h:12: >    In file included from include/linux/skbuff.h:28: >    In file included from include/linux/dma-mapping.h:11: >    In file included from include/linux/scatterlist.h:9: >    In file included from arch/s390/include/asm/io.h:78: >    include/asm-generic/io.h:584:33: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      584 |         __raw_writeb(value, PCI_IOBASE + addr); >          |                             ~~~~~~~~~~ ^ >    include/asm-generic/io.h:594:59: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      594 |         __raw_writew((u16 __force)cpu_to_le16(value), > PCI_IOBASE + addr); >          | >  ~~~~~~~~~~ ^ >    include/asm-generic/io.h:604:59: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      604 |         __raw_writel((u32 __force)cpu_to_le32(value), > PCI_IOBASE + addr); >          | >  ~~~~~~~~~~ ^ >    include/asm-generic/io.h:692:20: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      692 |         readsb(PCI_IOBASE + addr, buffer, count); >          |                ~~~~~~~~~~ ^ >    include/asm-generic/io.h:700:20: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      700 |         readsw(PCI_IOBASE + addr, buffer, count); >          |                ~~~~~~~~~~ ^ >    include/asm-generic/io.h:708:20: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      708 |         readsl(PCI_IOBASE + addr, buffer, count); >          |                ~~~~~~~~~~ ^ >    include/asm-generic/io.h:717:21: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      717 |         writesb(PCI_IOBASE + addr, buffer, count); >          |                 ~~~~~~~~~~ ^ >    include/asm-generic/io.h:726:21: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      726 |         writesw(PCI_IOBASE + addr, buffer, count); >          |                 ~~~~~~~~~~ ^ >    include/asm-generic/io.h:735:21: warning: performing pointer > arithmetic on a null pointer has undefined behavior > [-Wnull-pointer-arithmetic] >      735 |         writesl(PCI_IOBASE + addr, buffer, count); >          |                 ~~~~~~~~~~ ^ > >> kernel/bpf/bpf_struct_ops.c:247:16: warning: bitwise operation > between different enumeration types ('enum bpf_type_flag' and 'enum > bpf_reg_type') [-Wenum-enum-conversion] >      247 |                         PTR_TRUSTED | PTR_TO_BTF_ID | > PTR_MAYBE_NULL; >          |                         ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~ >    38 warnings generated. > > > vim +247 kernel/bpf/bpf_struct_ops.c > >    153 >    154  /* Prepare argument info for every nullable argument of a > member of a >    155   * struct_ops type. >    156   * >    157   * Initialize a struct bpf_struct_ops_arg_info according to > type info of >    158   * the arguments of a stub function. (Check kCFI for more > information about >    159   * stub functions.) >    160   * >    161   * Each member in the struct_ops type has a struct > bpf_struct_ops_arg_info >    162   * to provide an array of struct bpf_ctx_arg_aux, which in > turn provides >    163   * the information that used by the verifier to check the > arguments of the >    164   * BPF struct_ops program assigned to the member. Here, we > only care about >    165   * the arguments that are marked as __nullable. >    166   * >    167   * The array of struct bpf_ctx_arg_aux is eventually > assigned to >    168   * prog->aux->ctx_arg_info of BPF struct_ops programs and > passed to the >    169   * verifier. (See check_struct_ops_btf_id()) >    170   * >    171   * arg_info->info will be the list of struct > bpf_ctx_arg_aux if success. If >    172   * fails, it will be kept untouched. >    173   */ >    174  static int prepare_arg_info(struct btf *btf, >    175                              const char *st_ops_name, >    176                              const char *member_name, >    177                              const struct btf_type *func_proto, >    178                              struct bpf_struct_ops_arg_info > *arg_info) >    179  { >    180          const struct btf_type *stub_func_proto, *pointed_type; >    181          const struct btf_param *stub_args, *args; >    182          struct bpf_ctx_arg_aux *info, *info_buf; >    183          u32 nargs, arg_no, info_cnt = 0; >    184          u32 arg_btf_id; >    185          int offset; >    186 >    187          stub_func_proto = find_stub_func_proto(btf, > st_ops_name, member_name); >    188          if (!stub_func_proto) >    189                  return 0; >    190 >    191          /* Check if the number of arguments of the stub > function is the same >    192           * as the number of arguments of the function pointer. >    193           */ >    194          nargs = btf_type_vlen(func_proto); >    195          if (nargs != btf_type_vlen(stub_func_proto)) { >    196                  pr_warn("the number of arguments of the > stub function %s__%s does not match the number of arguments of the > member %s of struct %s\n", >    197                          st_ops_name, member_name, > member_name, st_ops_name); >    198                  return -EINVAL; >    199          } >    200 >    201          if (!nargs) >    202                  return 0; >    203 >    204          args = btf_params(func_proto); >    205          stub_args = btf_params(stub_func_proto); >    206 >    207          info_buf = kcalloc(nargs, sizeof(*info_buf), > GFP_KERNEL); >    208          if (!info_buf) >    209                  return -ENOMEM; >    210 >    211          /* Prepare info for every nullable argument */ >    212          info = info_buf; >    213          for (arg_no = 0; arg_no < nargs; arg_no++) { >    214                  /* Skip arguments that is not suffixed with >    215                   * "__nullable". >    216                   */ >    217                  if (!btf_param_match_suffix(btf, > &stub_args[arg_no], >    218                                              MAYBE_NULL_SUFFIX)) >    219                          continue; >    220 >    221                  /* Should be a pointer to struct */ >    222                  pointed_type = btf_type_resolve_ptr(btf, >    223 > args[arg_no].type, >    224 > &arg_btf_id); >    225                  if (!pointed_type || >    226                      !btf_type_is_struct(pointed_type)) { >    227                          pr_warn("stub function %s__%s has > %s tagging to an unsupported type\n", >    228                                  st_ops_name, member_name, > MAYBE_NULL_SUFFIX); >    229                          goto err_out; >    230                  } >    231 >    232                  offset = btf_ctx_arg_offset(btf, > func_proto, arg_no); >    233                  if (offset < 0) { >    234                          pr_warn("stub function %s__%s has > an invalid trampoline ctx offset for arg#%u\n", >    235                                  st_ops_name, member_name, > arg_no); >    236                          goto err_out; >    237                  } >    238 >    239                  if (args[arg_no].type != > stub_args[arg_no].type) { >    240                          pr_warn("arg#%u type in stub > function %s__%s does not match with its original func_proto\n", >    241                                  arg_no, st_ops_name, > member_name); >    242                          goto err_out; >    243                  } >    244 >    245                  /* Fill the information of the new argument */ >    246                  info->reg_type = >  > 247                          PTR_TRUSTED | PTR_TO_BTF_ID | > PTR_MAYBE_NULL; >    248                  info->btf_id = arg_btf_id; >    249                  info->btf = btf; >    250                  info->offset = offset; >    251 >    252                  info++; >    253                  info_cnt++; >    254          } >    255 >    256          if (info_cnt) { >    257                  arg_info->info = info_buf; >    258                  arg_info->cnt = info_cnt; >    259          } else { >    260                  kfree(info_buf); >    261          } >    262 >    263          return 0; >    264 >    265  err_out: >    266          kfree(info_buf); >    267 >    268          return -EINVAL; >    269  } >    270 > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki > >