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 X-Spam-Level: X-Spam-Status: No, score=-9.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A073AC433E0 for ; Thu, 11 Mar 2021 13:39:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E971664F48 for ; Thu, 11 Mar 2021 13:39:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E971664F48 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 00CCF8D02BD; Thu, 11 Mar 2021 08:39:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EFEE48D02B2; Thu, 11 Mar 2021 08:39:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC6FB8D02BD; Thu, 11 Mar 2021 08:39:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id C09498D02B2 for ; Thu, 11 Mar 2021 08:39:09 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 79FE5824999B for ; Thu, 11 Mar 2021 13:39:09 +0000 (UTC) X-FDA: 77907699618.06.05A7CA7 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by imf27.hostedemail.com (Postfix) with ESMTP id 1CB9E801914C for ; Thu, 11 Mar 2021 13:39:04 +0000 (UTC) Received: by mail-wr1-f43.google.com with SMTP id w11so1889910wrr.10 for ; Thu, 11 Mar 2021 05:39:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3aBSqhOa/RrVtCl7+qmV29JSn7bXYesRgGx4dSYwJ+U=; b=OGoMc3qnXL3QqmDBCZcWnFnmLAM+bAjDhMP8/hHtTSu5/X/bD8BpuElTT0GpUkfzwx EnL3agdWjTUe2JptrXuMQZT+RgePUYqq58Fnjk/b63Q/uO1gO/9tIqiBbdmsL9VyvuO8 78eE+BepuHK8353q34yBZwkXDu79f3u2XAnG0jMCZ6/XB1BfhqPJ4RJ1S2UImYOyXBNI 0Pu4mTA51zY+9pbLvcAS2i4NLQbg2nneUmukxxLu/ORs4mC1WirWCJqJ4/ve4P47qjeu XD3pa2T69RYYGwziGBQb8JDGCvR5MKxwFLS9HDhZR/0CX87M74ddCY19JGMka5X3lYNr yykQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3aBSqhOa/RrVtCl7+qmV29JSn7bXYesRgGx4dSYwJ+U=; b=cr7zeSWsFOWbmLaprdmCUP2/G4nqEmjewNuoWLHT6hwJ9rVLFGsfFcPnqJNVfEkSv8 lYJmrMds/D/o3PPsTROamf5t3v/0UXqsDSZH2k4IzxIXBhnGsoupzegAkras0KUNSakj XLZG89Jn2VPBSqThOEP0FuwdPOQinzZuP0E9FREVt7vk8jfqz2483WKGYDaUMeB+/svN M75tsXiJ+m/3kPhuQVAapCE7utIiox4FMuWssPrk1D+oLLn0qfPNmHeq5mC4iPNTmZjU JIxIYTQwBBisZ/CtWUULBb1DaZOnnMF2IYfxfXVFNsQ0yniJYmMpFq3XfTOgiqrbmTrf Io/g== X-Gm-Message-State: AOAM530akNBXAwcIr38JGL0hkuTK396aa5OI3Y6UKi28yd+emqi/wf0x gZ+7QvGB2Ghu2honEcTlOgI= X-Google-Smtp-Source: ABdhPJyHw69Me4R56u1lT2mGc0/4YjXTfIEGP0gQtBR7jsO5TRcFT/DsI1VJ1k32bN/NvMST3+Oohw== X-Received: by 2002:adf:c641:: with SMTP id u1mr8847471wrg.332.1615469947681; Thu, 11 Mar 2021 05:39:07 -0800 (PST) Received: from [192.168.2.202] (pd9e5ac74.dip0.t-ipconnect.de. [217.229.172.116]) by smtp.gmail.com with ESMTPSA id l15sm3835547wme.43.2021.03.11.05.39.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Mar 2021 05:39:07 -0800 (PST) Subject: Re: [linux-next:master 1430/3917] drivers/platform/surface/surface_aggregator_registry.c:398:25: warning: implicit conversion from 'int' to '__u8' (aka 'unsigned char') changes value from 65535 to 255 To: kernel test robot Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com, Linux Memory Management List , Hans de Goede References: <202103112158.loq4oyJu-lkp@intel.com> From: Maximilian Luz Message-ID: <8c252429-5000-0649-c49f-8225d911241b@gmail.com> Date: Thu, 11 Mar 2021 14:39:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <202103112158.loq4oyJu-lkp@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Stat-Signature: 5ixqkcazuqjru9rytwgnwwnhormxhjwx X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 1CB9E801914C Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf27; identity=mailfrom; envelope-from=""; helo=mail-wr1-f43.google.com; client-ip=209.85.221.43 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615469944-359063 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 3/11/21 2:06 PM, kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: 98546348153dee5f8ced572fd6c4690461d20f51 > commit: 797e78564634275ed4fe6b3f586c4b96eb1d86bc [1430/3917] platform/surface: aggregator_registry: Add base device hub > config: arm64-randconfig-r026-20210311 (attached as .config) > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 574a9dabc63ba1e7a04c08d4bde2eacd61b44ce1) > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # install arm64 cross compiling tool for clang build > # apt-get install binutils-aarch64-linux-gnu > # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=797e78564634275ed4fe6b3f586c4b96eb1d86bc > git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > git fetch --no-tags linux-next master > git checkout 797e78564634275ed4fe6b3f586c4b96eb1d86bc > # save the attached .config to linux build tree > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > > All warnings (new ones prefixed by >>): > > In file included from drivers/platform/surface/surface_aggregator_registry.c:12: > In file included from include/linux/acpi.h:35: > In file included from include/acpi/acpi_io.h:7: > In file included from arch/arm64/include/asm/acpi.h:12: > include/linux/efi.h:1093:34: warning: passing 1-byte aligned argument to 4-byte aligned parameter 2 of 'get_var' may result in an unaligned pointer access [-Walign-mismatch] > status = get_var(L"SecureBoot", &EFI_GLOBAL_VARIABLE_GUID, NULL, &size, > ^ > include/linux/efi.h:1101:24: warning: passing 1-byte aligned argument to 4-byte aligned parameter 2 of 'get_var' may result in an unaligned pointer access [-Walign-mismatch] > get_var(L"SetupMode", &EFI_GLOBAL_VARIABLE_GUID, NULL, &size, &setupmode); > ^ > >> drivers/platform/surface/surface_aggregator_registry.c:398:25: warning: implicit conversion from 'int' to '__u8' (aka 'unsigned char') changes value from 65535 to 255 [-Wconstant-conversion] > { SSAM_VDEV(HUB, 0x02, SSAM_ANY_IID, 0x00) }, > ~ ^~~~~~~~~~~~ This is a false positive: > include/linux/surface_aggregator/device.h:71:23: note: expanded from macro 'SSAM_ANY_IID' > #define SSAM_ANY_IID 0xffff > ^~~~~~ Here, clang complains that the input is SSAM_ANY_ID. That is a special value which has special considerations below. The SSAM_DEVICE() and thus SSAM_VDEV() macros are intended to only allow either __u8 or SSAM_ANY_ID as input in this place. > include/linux/surface_aggregator/device.h:126:63: note: expanded from macro 'SSAM_VDEV' > SSAM_DEVICE(SSAM_DOMAIN_VIRTUAL, SSAM_VIRTUAL_TC_##cat, tid, iid, fun) > ^~~ > include/linux/surface_aggregator/device.h:102:41: note: expanded from macro 'SSAM_DEVICE' > .instance = ((iid) != SSAM_ANY_IID) ? (iid) : 0, \ > ^~~ Here is the special handling for SSAM_ANY_ID. So there is an implicit conversion from iid, which may be __u8, to int (i.e. the type of SSAM_ANY_ID), but there is at no point any implicit conversion of SSAM_ANY_ID to __u8, as clang alleges. Is there any way to silence this warning in particular without suppressing it (e.g. by explicit casting) when users of this macro _actually_ input any non-u8 and non-SSAM_ANY_ID value as iid, leading to an _actual_ implicit value-changing cast? I believe GCC does get this right and only emits a warning if a non-u8 _and_ non-SSAM_ANY_ID value is input. Regards, Max > 3 warnings generated. > > > vim +398 drivers/platform/surface/surface_aggregator_registry.c > > 396 > 397 static const struct ssam_device_id ssam_base_hub_match[] = { > > 398 { SSAM_VDEV(HUB, 0x02, SSAM_ANY_IID, 0x00) }, > 399 { }, > 400 }; > 401 > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org >