linux-cxl.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Ben Cheatham <Benjamin.Cheatham@amd.com>, rafael@kernel.org
Cc: oe-kbuild-all@lists.linux.dev, benjamin.cheatham@amd.com,
	yazen.ghannam@amd.com, linux-acpi@vger.kernel.org,
	linux-cxl@vger.kernel.org, tony.luck@intel.com
Subject: Re: [PATCH] ACPI, APEI, EINJ: Remove memory range validation for CXL error types
Date: Thu, 30 Mar 2023 03:28:38 +0800	[thread overview]
Message-ID: <202303300345.QZXN7i0i-lkp@intel.com> (raw)
In-Reply-To: <20230329143813.25849-1-Benjamin.Cheatham@amd.com>

Hi Ben,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.3-rc4 next-20230329]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ben-Cheatham/ACPI-APEI-EINJ-Remove-memory-range-validation-for-CXL-error-types/20230329-224405
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20230329143813.25849-1-Benjamin.Cheatham%40amd.com
patch subject: [PATCH] ACPI, APEI, EINJ: Remove memory range validation for CXL error types
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230330/202303300345.QZXN7i0i-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/f0c48248d842ab224de7ac3d62d260e9f411e80c
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Ben-Cheatham/ACPI-APEI-EINJ-Remove-memory-range-validation-for-CXL-error-types/20230329-224405
        git checkout f0c48248d842ab224de7ac3d62d260e9f411e80c
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 olddefconfig
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/acpi/apei/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303300345.QZXN7i0i-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/acpi/apei/einj.c: In function 'einj_error_inject':
>> drivers/acpi/apei/einj.c:527:13: warning: unused variable 'available_error_types' [-Wunused-variable]
     527 |         u32 available_error_types = 0;
         |             ^~~~~~~~~~~~~~~~~~~~~


vim +/available_error_types +527 drivers/acpi/apei/einj.c

   521	
   522	/* Inject the specified hardware error */
   523	static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
   524				     u64 param3, u64 param4)
   525	{
   526		int rc;
 > 527		u32 available_error_types = 0;
   528		u64 base_addr, size;
   529	
   530		/* If user manually set "flags", make sure it is legal */
   531		if (flags && (flags &
   532			~(SETWA_FLAGS_APICID|SETWA_FLAGS_MEM|SETWA_FLAGS_PCIE_SBDF)))
   533			return -EINVAL;
   534	
   535		/*
   536		 * We need extra sanity checks for memory errors.
   537		 * Other types leap directly to injection.
   538		 */
   539	
   540		/* ensure param1/param2 existed */
   541		if (!(param_extension || acpi5))
   542			goto inject;
   543	
   544		/* ensure injection is memory related */
   545		if (type & ACPI5_VENDOR_BIT) {
   546			if (vendor_flags != SETWA_FLAGS_MEM)
   547				goto inject;
   548		} else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM)) {
   549			goto inject;
   550		} else if (type & CXL_ERROR_MASK) {
   551			goto inject;
   552		}
   553	
   554		/*
   555		 * Disallow crazy address masks that give BIOS leeway to pick
   556		 * injection address almost anywhere. Insist on page or
   557		 * better granularity and that target address is normal RAM or
   558		 * NVDIMM.
   559		 */
   560		base_addr = param1 & param2;
   561		size = ~param2 + 1;
   562	
   563		if (((param2 & PAGE_MASK) != PAGE_MASK) ||
   564		    ((region_intersects(base_addr, size, IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE)
   565					!= REGION_INTERSECTS) &&
   566		     (region_intersects(base_addr, size, IORESOURCE_MEM, IORES_DESC_PERSISTENT_MEMORY)
   567					!= REGION_INTERSECTS) &&
   568		     (region_intersects(base_addr, size, IORESOURCE_MEM, IORES_DESC_SOFT_RESERVED)
   569					!= REGION_INTERSECTS) &&
   570		     !arch_is_platform_page(base_addr)))
   571			return -EINVAL;
   572	
   573		if (is_zero_pfn(base_addr >> PAGE_SHIFT))
   574			return -EADDRINUSE;
   575	
   576	inject:
   577		mutex_lock(&einj_mutex);
   578		rc = __einj_error_inject(type, flags, param1, param2, param3, param4);
   579		mutex_unlock(&einj_mutex);
   580	
   581		return rc;
   582	}
   583	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

      parent reply	other threads:[~2023-03-29 19:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 14:38 [PATCH] ACPI, APEI, EINJ: Remove memory range validation for CXL error types Ben Cheatham
2023-03-29 14:41 ` Rafael J. Wysocki
2023-03-29 19:28 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202303300345.QZXN7i0i-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Benjamin.Cheatham@amd.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=rafael@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=yazen.ghannam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).