public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Sean Christopherson <seanjc@google.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [sean-jc:svm/rewrite_dbg_cmds 3/5] arch/x86/kvm/svm/sev.c:1968:20: error: incompatible pointer types passing 'struct page *' to parameter of type 'struct page **'; take the address with &
Date: Fri, 17 Apr 2026 18:12:45 +0800	[thread overview]
Message-ID: <202604171836.TgNX7ADT-lkp@intel.com> (raw)

Hi Sean,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree:   https://github.com/sean-jc/linux svm/rewrite_dbg_cmds
head:   1355c91eb47e8bea0a1addb82d3a7aed3288a5a3
commit: d730a1d766569b0ab715eb4cfb175ccd64b2e570 [3/5] KVM: SEV: Add helper function to pin/unpin a single page
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260417/202604171836.TgNX7ADT-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260417/202604171836.TgNX7ADT-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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604171836.TgNX7ADT-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

>> arch/x86/kvm/svm/sev.c:1742:16: warning: unused variable 'n' [-Wunused-variable]
    1742 |         unsigned long n;
         |                       ^
>> arch/x86/kvm/svm/sev.c:1968:20: error: incompatible pointer types passing 'struct page *' to parameter of type 'struct page **'; take the address with & [-Werror,-Wincompatible-pointer-types]
    1968 |         sev_clflush_pages(guest_page, n);
         |                           ^~~~~~~~~~
         |                           &
   arch/x86/kvm/svm/sev.c:837:44: note: passing argument to parameter 'pages' here
     837 | static void sev_clflush_pages(struct page *pages[], unsigned long npages)
         |                                            ^
   arch/x86/kvm/svm/sev.c:1968:32: warning: variable 'n' is uninitialized when used here [-Wuninitialized]
    1968 |         sev_clflush_pages(guest_page, n);
         |                                       ^
   arch/x86/kvm/svm/sev.c:1920:17: note: initialize the variable 'n' to silence this warning
    1920 |         unsigned long n;
         |                        ^
         |                         = 0
   2 warnings and 1 error generated.


vim +1968 arch/x86/kvm/svm/sev.c

af43cbbf954b50 Brijesh Singh       2021-04-15  1913  
15fb7de1a7f5af Brijesh Singh       2021-04-15  1914  static int sev_receive_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp)
15fb7de1a7f5af Brijesh Singh       2021-04-15  1915  {
15fb7de1a7f5af Brijesh Singh       2021-04-15  1916  	struct kvm_sev_receive_update_data params;
238eca821cee90 Sean Christopherson 2021-04-06  1917  	struct sev_data_receive_update_data data;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1918  	void *hdr = NULL, *trans = NULL;
d730a1d766569b Sean Christopherson 2026-04-16  1919  	struct page *guest_page;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1920  	unsigned long n;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1921  	int ret, offset;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1922  
15fb7de1a7f5af Brijesh Singh       2021-04-15  1923  	if (!sev_guest(kvm))
15fb7de1a7f5af Brijesh Singh       2021-04-15  1924  		return -EINVAL;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1925  
1ab157ce573f5a Paolo Bonzini       2024-02-26  1926  	if (copy_from_user(&params, u64_to_user_ptr(argp->data),
15fb7de1a7f5af Brijesh Singh       2021-04-15  1927  			sizeof(struct kvm_sev_receive_update_data)))
15fb7de1a7f5af Brijesh Singh       2021-04-15  1928  		return -EFAULT;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1929  
15fb7de1a7f5af Brijesh Singh       2021-04-15  1930  	if (!params.hdr_uaddr || !params.hdr_len ||
15fb7de1a7f5af Brijesh Singh       2021-04-15  1931  	    !params.guest_uaddr || !params.guest_len ||
15fb7de1a7f5af Brijesh Singh       2021-04-15  1932  	    !params.trans_uaddr || !params.trans_len)
15fb7de1a7f5af Brijesh Singh       2021-04-15  1933  		return -EINVAL;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1934  
15fb7de1a7f5af Brijesh Singh       2021-04-15  1935  	/* Check if we are crossing the page boundary */
15fb7de1a7f5af Brijesh Singh       2021-04-15  1936  	offset = params.guest_uaddr & (PAGE_SIZE - 1);
f94f053aa3a5d6 Peter Gonda         2023-02-07  1937  	if (params.guest_len > PAGE_SIZE || (params.guest_len + offset) > PAGE_SIZE)
15fb7de1a7f5af Brijesh Singh       2021-04-15  1938  		return -EINVAL;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1939  
15fb7de1a7f5af Brijesh Singh       2021-04-15  1940  	hdr = psp_copy_user_blob(params.hdr_uaddr, params.hdr_len);
15fb7de1a7f5af Brijesh Singh       2021-04-15  1941  	if (IS_ERR(hdr))
15fb7de1a7f5af Brijesh Singh       2021-04-15  1942  		return PTR_ERR(hdr);
15fb7de1a7f5af Brijesh Singh       2021-04-15  1943  
15fb7de1a7f5af Brijesh Singh       2021-04-15  1944  	trans = psp_copy_user_blob(params.trans_uaddr, params.trans_len);
15fb7de1a7f5af Brijesh Singh       2021-04-15  1945  	if (IS_ERR(trans)) {
15fb7de1a7f5af Brijesh Singh       2021-04-15  1946  		ret = PTR_ERR(trans);
15fb7de1a7f5af Brijesh Singh       2021-04-15  1947  		goto e_free_hdr;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1948  	}
15fb7de1a7f5af Brijesh Singh       2021-04-15  1949  
238eca821cee90 Sean Christopherson 2021-04-06  1950  	memset(&data, 0, sizeof(data));
238eca821cee90 Sean Christopherson 2021-04-06  1951  	data.hdr_address = __psp_pa(hdr);
238eca821cee90 Sean Christopherson 2021-04-06  1952  	data.hdr_len = params.hdr_len;
238eca821cee90 Sean Christopherson 2021-04-06  1953  	data.trans_address = __psp_pa(trans);
238eca821cee90 Sean Christopherson 2021-04-06  1954  	data.trans_len = params.trans_len;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1955  
15fb7de1a7f5af Brijesh Singh       2021-04-15  1956  	/* Pin guest memory */
d730a1d766569b Sean Christopherson 2026-04-16  1957  	guest_page = sev_pin_page(kvm, params.guest_uaddr & PAGE_MASK, FOLL_WRITE);
c7a1b2b678c54a Sean Christopherson 2021-05-06  1958  	if (IS_ERR(guest_page)) {
c7a1b2b678c54a Sean Christopherson 2021-05-06  1959  		ret = PTR_ERR(guest_page);
238eca821cee90 Sean Christopherson 2021-04-06  1960  		goto e_free_trans;
c7a1b2b678c54a Sean Christopherson 2021-05-06  1961  	}
15fb7de1a7f5af Brijesh Singh       2021-04-15  1962  
c8c340a9b4149f Masahiro Kozuka     2021-09-14  1963  	/*
c8c340a9b4149f Masahiro Kozuka     2021-09-14  1964  	 * Flush (on non-coherent CPUs) before RECEIVE_UPDATE_DATA, the PSP
c8c340a9b4149f Masahiro Kozuka     2021-09-14  1965  	 * encrypts the written data with the guest's key, and the cache may
c8c340a9b4149f Masahiro Kozuka     2021-09-14  1966  	 * contain dirty, unencrypted data.
c8c340a9b4149f Masahiro Kozuka     2021-09-14  1967  	 */
c8c340a9b4149f Masahiro Kozuka     2021-09-14 @1968  	sev_clflush_pages(guest_page, n);
c8c340a9b4149f Masahiro Kozuka     2021-09-14  1969  
15fb7de1a7f5af Brijesh Singh       2021-04-15  1970  	/* The RECEIVE_UPDATE_DATA command requires C-bit to be always set. */
d730a1d766569b Sean Christopherson 2026-04-16  1971  	data.guest_address = page_to_phys(guest_page) + offset;
238eca821cee90 Sean Christopherson 2021-04-06  1972  	data.guest_address |= sev_me_mask;
238eca821cee90 Sean Christopherson 2021-04-06  1973  	data.guest_len = params.guest_len;
8a01902a016824 Nikunj A Dadhania   2025-01-23  1974  	data.handle = to_kvm_sev_info(kvm)->handle;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1975  
238eca821cee90 Sean Christopherson 2021-04-06  1976  	ret = sev_issue_cmd(kvm, SEV_CMD_RECEIVE_UPDATE_DATA, &data,
15fb7de1a7f5af Brijesh Singh       2021-04-15  1977  				&argp->error);
15fb7de1a7f5af Brijesh Singh       2021-04-15  1978  
d730a1d766569b Sean Christopherson 2026-04-16  1979  	sev_unpin_page(kvm, guest_page);
15fb7de1a7f5af Brijesh Singh       2021-04-15  1980  
15fb7de1a7f5af Brijesh Singh       2021-04-15  1981  e_free_trans:
15fb7de1a7f5af Brijesh Singh       2021-04-15  1982  	kfree(trans);
15fb7de1a7f5af Brijesh Singh       2021-04-15  1983  e_free_hdr:
15fb7de1a7f5af Brijesh Singh       2021-04-15  1984  	kfree(hdr);
15fb7de1a7f5af Brijesh Singh       2021-04-15  1985  
15fb7de1a7f5af Brijesh Singh       2021-04-15  1986  	return ret;
15fb7de1a7f5af Brijesh Singh       2021-04-15  1987  }
15fb7de1a7f5af Brijesh Singh       2021-04-15  1988  

:::::: The code at line 1968 was first introduced by commit
:::::: c8c340a9b4149fe5caa433f3b62463a1c8e07a46 KVM: SEV: Flush cache on non-coherent systems before RECEIVE_UPDATE_DATA

:::::: TO: Masahiro Kozuka <masa.koz@kozuka.jp>
:::::: CC: Paolo Bonzini <pbonzini@redhat.com>

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

                 reply	other threads:[~2026-04-17 10:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202604171836.TgNX7ADT-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=seanjc@google.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