mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [gustavoars:testing/kspp-stringop-overflow 5/5] arch/x86/mm/pgtable.c:442:27: warning: variable 'pmds' is uninitialized when used here
Date: Tue, 29 Mar 2022 14:32:37 +0800	[thread overview]
Message-ID: <202203291404.IHkCx1AG-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/kspp-stringop-overflow
head:   d3becb16bbfe48ca524e4489b6c6c4fb1ccafa1a
commit: d3becb16bbfe48ca524e4489b6c6c4fb1ccafa1a [5/5] mm/pgtable: Fix Wstringop-overflow warnings in pgd_alloc()
config: i386-randconfig-a012-20220328 (https://download.01.org/0day-ci/archive/20220329/202203291404.IHkCx1AG-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
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://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=d3becb16bbfe48ca524e4489b6c6c4fb1ccafa1a
        git remote add gustavoars https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
        git fetch --no-tags gustavoars testing/kspp-stringop-overflow
        git checkout d3becb16bbfe48ca524e4489b6c6c4fb1ccafa1a
        # 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=i386 SHELL=/bin/bash arch/x86/mm/

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

All warnings (new ones prefixed by >>):

>> arch/x86/mm/pgtable.c:442:27: warning: variable 'pmds' is uninitialized when used here [-Wuninitialized]
           if (preallocate_pmds(mm, pmds, PREALLOCATED_PMDS) != 0)
                                    ^~~~
   arch/x86/mm/pgtable.c:432:14: note: initialize the variable 'pmds' to silence this warning
           pmd_t **pmds;
                       ^
                        = NULL
>> arch/x86/mm/pgtable.c:445:27: warning: variable 'u_pmds' is uninitialized when used here [-Wuninitialized]
           if (preallocate_pmds(mm, u_pmds, PREALLOCATED_USER_PMDS) != 0)
                                    ^~~~~~
   arch/x86/mm/pgtable.c:431:16: note: initialize the variable 'u_pmds' to silence this warning
           pmd_t **u_pmds;
                         ^
                          = NULL
   2 warnings generated.


vim +/pmds +442 arch/x86/mm/pgtable.c

1ec1fe73dfb711 Ingo Molnar         2008-03-19  434  
1db491f77b6ed0 Fenghua Yu          2015-01-15  435  	pgd = _pgd_alloc();
1ec1fe73dfb711 Ingo Molnar         2008-03-19  436  
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  437  	if (pgd == NULL)
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  438  		goto out;
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  439  
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  440  	mm->pgd = pgd;
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  441  
f59dbe9ca6707e Joerg Roedel        2018-07-18 @442  	if (preallocate_pmds(mm, pmds, PREALLOCATED_PMDS) != 0)
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  443  		goto out_free_pgd;
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  444  
f59dbe9ca6707e Joerg Roedel        2018-07-18 @445  	if (preallocate_pmds(mm, u_pmds, PREALLOCATED_USER_PMDS) != 0)
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  446  		goto out_free_pmds;
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  447  
f59dbe9ca6707e Joerg Roedel        2018-07-18  448  	if (paravirt_pgd_alloc(mm) != 0)
f59dbe9ca6707e Joerg Roedel        2018-07-18  449  		goto out_free_user_pmds;
f59dbe9ca6707e Joerg Roedel        2018-07-18  450  
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  451  	/*
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  452  	 * Make sure that pre-populating the pmds is atomic with
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  453  	 * respect to anything walking the pgd_list, so that they
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  454  	 * never see a partially populated pgd.
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  455  	 */
a79e53d85683c6 Andrea Arcangeli    2011-02-16  456  	spin_lock(&pgd_lock);
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  457  
617d34d9e5d832 Jeremy Fitzhardinge 2010-09-21  458  	pgd_ctor(mm, pgd);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  459  	pgd_prepopulate_pmd(mm, pgd, pmds);
f59dbe9ca6707e Joerg Roedel        2018-07-18  460  	pgd_prepopulate_user_pmd(mm, pgd, u_pmds);
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  461  
a79e53d85683c6 Andrea Arcangeli    2011-02-16  462  	spin_unlock(&pgd_lock);
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  463  
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  464  	return pgd;
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  465  
f59dbe9ca6707e Joerg Roedel        2018-07-18  466  out_free_user_pmds:
f59dbe9ca6707e Joerg Roedel        2018-07-18  467  	free_pmds(mm, u_pmds, PREALLOCATED_USER_PMDS);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  468  out_free_pmds:
f59dbe9ca6707e Joerg Roedel        2018-07-18  469  	free_pmds(mm, pmds, PREALLOCATED_PMDS);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  470  out_free_pgd:
1db491f77b6ed0 Fenghua Yu          2015-01-15  471  	_pgd_free(pgd);
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  472  out:
d8d5900ef8afc5 Jeremy Fitzhardinge 2008-06-25  473  	return NULL;
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  474  }
4f76cd382213b2 Jeremy Fitzhardinge 2008-03-17  475  

:::::: The code at line 442 was first introduced by commit
:::::: f59dbe9ca6707eb7ffd0e24359085651c2d7df48 x86/pgtable/pae: Use separate kernel PMDs for user page-table

:::::: TO: Joerg Roedel <jroedel@suse.de>
:::::: CC: Thomas Gleixner <tglx@linutronix.de>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

                 reply	other threads:[~2022-03-29  6:33 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=202203291404.IHkCx1AG-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gustavo@embeddedor.com \
    --cc=gustavoars@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®