All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Zhou Qingyang <zhou1615@umn.edu>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org, kjlu@umn.edu,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Lv Zheng <lv.zheng@intel.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ACPI / tables: Fix a NULL pointer dereference in acpi_table_initrd_override()
Date: Tue, 25 Jan 2022 11:06:43 +0800	[thread overview]
Message-ID: <202201251123.ScbhjE9a-lkp@intel.com> (raw)
In-Reply-To: <20220124164251.52466-1-zhou1615@umn.edu>

Hi Zhou,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on linux/master linus/master v5.17-rc1 next-20220124]
[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]

url:    https://github.com/0day-ci/linux/commits/Zhou-Qingyang/ACPI-tables-Fix-a-NULL-pointer-dereference-in-acpi_table_initrd_override/20220125-004517
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-r011-20220124 (https://download.01.org/0day-ci/archive/20220125/202201251123.ScbhjE9a-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2e58a18910867ba6795066e044293e6daf89edf5)
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
        # https://github.com/0day-ci/linux/commit/924d4e212d2041e2af120ade3599fdc00e0b12fd
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Zhou-Qingyang/ACPI-tables-Fix-a-NULL-pointer-dereference-in-acpi_table_initrd_override/20220125-004517
        git checkout 924d4e212d2041e2af120ade3599fdc00e0b12fd
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/acpi/tables.c:710:4: error: void function 'acpi_table_initrd_scan' should not return a value [-Wreturn-type]
                           return AE_NO_MEMORY;
                           ^      ~~~~~~~~~~~~
   1 error generated.


vim +/acpi_table_initrd_scan +710 drivers/acpi/tables.c

   695	
   696	static void __init acpi_table_initrd_scan(void)
   697	{
   698		int table_offset = 0;
   699		int table_index = 0;
   700		u32 table_length;
   701		struct acpi_table_header *table;
   702	
   703		if (!acpi_tables_addr)
   704			return;
   705	
   706		while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) {
   707			table = acpi_os_map_memory(acpi_tables_addr + table_offset,
   708						   ACPI_HEADER_SIZE);
   709			if (!table) {
 > 710				return AE_NO_MEMORY;
   711			}
   712	
   713			if (table_offset + table->length > all_tables_size) {
   714				acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
   715				WARN_ON(1);
   716				return;
   717			}
   718	
   719			table_length = table->length;
   720	
   721			/* Skip RSDT/XSDT which should only be used for override */
   722			if (ACPI_COMPARE_NAMESEG(table->signature, ACPI_SIG_RSDT) ||
   723			    ACPI_COMPARE_NAMESEG(table->signature, ACPI_SIG_XSDT)) {
   724				acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
   725				goto next_table;
   726			}
   727			/*
   728			 * Mark the table to avoid being used in
   729			 * acpi_table_initrd_override(). Though this is not possible
   730			 * because override is disabled in acpi_install_physical_table().
   731			 */
   732			if (test_and_set_bit(table_index, acpi_initrd_installed)) {
   733				acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
   734				goto next_table;
   735			}
   736	
   737			pr_info("Table Upgrade: install [%4.4s-%6.6s-%8.8s]\n",
   738				table->signature, table->oem_id,
   739				table->oem_table_id);
   740			acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
   741			acpi_install_physical_table(acpi_tables_addr + table_offset);
   742	next_table:
   743			table_offset += table_length;
   744			table_index++;
   745		}
   746	}
   747	#else
   748	static acpi_status
   749	acpi_table_initrd_override(struct acpi_table_header *existing_table,
   750				   acpi_physical_address *address,
   751				   u32 *table_length)
   752	{
   753		*table_length = 0;
   754		*address = 0;
   755		return AE_OK;
   756	}
   757	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] ACPI / tables: Fix a NULL pointer dereference in acpi_table_initrd_override()
Date: Tue, 25 Jan 2022 11:06:43 +0800	[thread overview]
Message-ID: <202201251123.ScbhjE9a-lkp@intel.com> (raw)
In-Reply-To: <20220124164251.52466-1-zhou1615@umn.edu>

[-- Attachment #1: Type: text/plain, Size: 4345 bytes --]

Hi Zhou,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on linux/master linus/master v5.17-rc1 next-20220124]
[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]

url:    https://github.com/0day-ci/linux/commits/Zhou-Qingyang/ACPI-tables-Fix-a-NULL-pointer-dereference-in-acpi_table_initrd_override/20220125-004517
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-r011-20220124 (https://download.01.org/0day-ci/archive/20220125/202201251123.ScbhjE9a-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2e58a18910867ba6795066e044293e6daf89edf5)
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
        # https://github.com/0day-ci/linux/commit/924d4e212d2041e2af120ade3599fdc00e0b12fd
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Zhou-Qingyang/ACPI-tables-Fix-a-NULL-pointer-dereference-in-acpi_table_initrd_override/20220125-004517
        git checkout 924d4e212d2041e2af120ade3599fdc00e0b12fd
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/acpi/tables.c:710:4: error: void function 'acpi_table_initrd_scan' should not return a value [-Wreturn-type]
                           return AE_NO_MEMORY;
                           ^      ~~~~~~~~~~~~
   1 error generated.


vim +/acpi_table_initrd_scan +710 drivers/acpi/tables.c

   695	
   696	static void __init acpi_table_initrd_scan(void)
   697	{
   698		int table_offset = 0;
   699		int table_index = 0;
   700		u32 table_length;
   701		struct acpi_table_header *table;
   702	
   703		if (!acpi_tables_addr)
   704			return;
   705	
   706		while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) {
   707			table = acpi_os_map_memory(acpi_tables_addr + table_offset,
   708						   ACPI_HEADER_SIZE);
   709			if (!table) {
 > 710				return AE_NO_MEMORY;
   711			}
   712	
   713			if (table_offset + table->length > all_tables_size) {
   714				acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
   715				WARN_ON(1);
   716				return;
   717			}
   718	
   719			table_length = table->length;
   720	
   721			/* Skip RSDT/XSDT which should only be used for override */
   722			if (ACPI_COMPARE_NAMESEG(table->signature, ACPI_SIG_RSDT) ||
   723			    ACPI_COMPARE_NAMESEG(table->signature, ACPI_SIG_XSDT)) {
   724				acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
   725				goto next_table;
   726			}
   727			/*
   728			 * Mark the table to avoid being used in
   729			 * acpi_table_initrd_override(). Though this is not possible
   730			 * because override is disabled in acpi_install_physical_table().
   731			 */
   732			if (test_and_set_bit(table_index, acpi_initrd_installed)) {
   733				acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
   734				goto next_table;
   735			}
   736	
   737			pr_info("Table Upgrade: install [%4.4s-%6.6s-%8.8s]\n",
   738				table->signature, table->oem_id,
   739				table->oem_table_id);
   740			acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
   741			acpi_install_physical_table(acpi_tables_addr + table_offset);
   742	next_table:
   743			table_offset += table_length;
   744			table_index++;
   745		}
   746	}
   747	#else
   748	static acpi_status
   749	acpi_table_initrd_override(struct acpi_table_header *existing_table,
   750				   acpi_physical_address *address,
   751				   u32 *table_length)
   752	{
   753		*table_length = 0;
   754		*address = 0;
   755		return AE_OK;
   756	}
   757	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

  reply	other threads:[~2022-01-25  4:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 16:42 [PATCH] ACPI / tables: Fix a NULL pointer dereference in acpi_table_initrd_override() Zhou Qingyang
2022-01-25  3:06 ` kernel test robot [this message]
2022-01-25  3:06   ` kernel test robot
2022-01-28 10:17 ` Greg KH

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=202201251123.ScbhjE9a-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kjlu@umn.edu \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=lv.zheng@intel.com \
    --cc=rafael@kernel.org \
    --cc=zhou1615@umn.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.