CC: [email protected]
CC: [email protected]
TO: Luc Van Oostenryck <[email protected]>
CC: Andrew Morton <[email protected]>
CC: Linux Memory Management List <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   bf9f243f23e6623f310ba03fbb14e10ec3a61290
commit: d991bb1c8da842a2a0b9dc83b1005e655783f861 include/linux/compiler-gcc.h: 
sparse can do constant folding of __builtin_bswap*()
date:   4 months ago
:::::: branch date: 10 hours ago
:::::: commit date: 4 months ago
config: powerpc64-randconfig-m031-20210910 (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

New smatch warnings:
arch/powerpc/kernel/rtas.c:1099 __do_sys_rtas() warn: potential spectre issue 
'args.args' [r] (local cap)
arch/powerpc/kernel/rtas.c:1099 __do_sys_rtas() warn: potential spectre issue 
'args.args' [r] (local cap)

Old smatch warnings:
arch/powerpc/kernel/rtas.c:1202 rtas_initialize() error: '%pa' expects argument 
of type 'phys_addr_t*', argument 3 has type 'ulong*'

vim +1099 arch/powerpc/kernel/rtas.c

bd59380c5ba414 arch/powerpc/kernel/rtas.c Andrew Donnellan       2020-08-20  
1064  
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1065  /* We assume to be passed big endian arguments */
4c392e6591e325 arch/powerpc/kernel/rtas.c Al Viro                2018-05-02  
1066  SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs)
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1067  {
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1068       struct rtas_args args;
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1069       unsigned long flags;
033ef338b6e007 arch/powerpc/kernel/rtas.c Paul Mackerras         2005-10-26  
1070       char *buff_copy, *errbuf = NULL;
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1071       int nargs, nret, token;
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1072  
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1073       if (!capable(CAP_SYS_ADMIN))
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1074               return -EPERM;
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1075  
8832317f662c06 arch/powerpc/kernel/rtas.c Vasant Hegde           2015-10-16  
1076       if (!rtas.entry)
8832317f662c06 arch/powerpc/kernel/rtas.c Vasant Hegde           2015-10-16  
1077               return -EINVAL;
8832317f662c06 arch/powerpc/kernel/rtas.c Vasant Hegde           2015-10-16  
1078  
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1079       if (copy_from_user(&args, uargs, 3 * sizeof(u32)) != 0)
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1080               return -EFAULT;
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1081  
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1082       nargs = be32_to_cpu(args.nargs);
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1083       nret  = be32_to_cpu(args.nret);
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1084       token = be32_to_cpu(args.token);
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1085  
a9862c7440f191 arch/powerpc/kernel/rtas.c Andrew Donnellan       2016-03-18  
1086       if (nargs >= ARRAY_SIZE(args.args)
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1087           || nret > ARRAY_SIZE(args.args)
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1088           || nargs + nret > ARRAY_SIZE(args.args))
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1089               return -EINVAL;
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1090  
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1091       /* Copy in args. */
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1092       if (copy_from_user(args.args, uargs->args,
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1093                          nargs * sizeof(rtas_arg_t)) != 0)
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1094               return -EFAULT;
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1095  
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1096       if (token == RTAS_UNKNOWN_SERVICE)
91dc182ca6e25e arch/powerpc/kernel/rtas.c Dave C Boutcher        2006-01-13  
1097               return -EINVAL;
91dc182ca6e25e arch/powerpc/kernel/rtas.c Dave C Boutcher        2006-01-13  
1098  
b79998fc2e1144 arch/powerpc/kernel/rtas.c Nathan Fontenot        2008-07-31 
@1099       args.rets = &args.args[nargs];
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1100       memset(args.rets, 0, nret * sizeof(rtas_arg_t));
b79998fc2e1144 arch/powerpc/kernel/rtas.c Nathan Fontenot        2008-07-31  
1101  
bd59380c5ba414 arch/powerpc/kernel/rtas.c Andrew Donnellan       2020-08-20  
1102       if (block_rtas_call(token, nargs, &args))
bd59380c5ba414 arch/powerpc/kernel/rtas.c Andrew Donnellan       2020-08-20  
1103               return -EINVAL;
bd59380c5ba414 arch/powerpc/kernel/rtas.c Andrew Donnellan       2020-08-20  
1104  
91dc182ca6e25e arch/powerpc/kernel/rtas.c Dave C Boutcher        2006-01-13  
1105       /* Need to handle ibm,suspend_me call specially */
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1106       if (token == ibm_suspend_me_token) {
3df76a9dcc74d5 arch/powerpc/kernel/rtas.c Cyril Bur              2015-01-21  
1107  
3df76a9dcc74d5 arch/powerpc/kernel/rtas.c Cyril Bur              2015-01-21  
1108               /*
c03e73740d24fb arch/powerpc/kernel/rtas.c Tyrel Datwyler         2015-03-27  
1109                * rtas_ibm_suspend_me assumes the streamid handle is in cpu
c03e73740d24fb arch/powerpc/kernel/rtas.c Tyrel Datwyler         2015-03-27  
1110                * endian, or at least the hcall within it requires it.
3df76a9dcc74d5 arch/powerpc/kernel/rtas.c Cyril Bur              2015-01-21  
1111                */
c03e73740d24fb arch/powerpc/kernel/rtas.c Tyrel Datwyler         2015-03-27  
1112               int rc = 0;
3df76a9dcc74d5 arch/powerpc/kernel/rtas.c Cyril Bur              2015-01-21  
1113               u64 handle = ((u64)be32_to_cpu(args.args[0]) << 32)
3df76a9dcc74d5 arch/powerpc/kernel/rtas.c Cyril Bur              2015-01-21  
1114                             | be32_to_cpu(args.args[1]);
4d756894ba75f1 arch/powerpc/kernel/rtas.c Nathan Lynch           2020-12-07  
1115               rc = rtas_syscall_dispatch_ibm_suspend_me(handle);
c03e73740d24fb arch/powerpc/kernel/rtas.c Tyrel Datwyler         2015-03-27  
1116               if (rc == -EAGAIN)
c03e73740d24fb arch/powerpc/kernel/rtas.c Tyrel Datwyler         2015-03-27  
1117                       args.rets[0] = cpu_to_be32(RTAS_NOT_SUSPENDABLE);
c03e73740d24fb arch/powerpc/kernel/rtas.c Tyrel Datwyler         2015-03-27  
1118               else if (rc == -EIO)
c03e73740d24fb arch/powerpc/kernel/rtas.c Tyrel Datwyler         2015-03-27  
1119                       args.rets[0] = cpu_to_be32(-1);
c03e73740d24fb arch/powerpc/kernel/rtas.c Tyrel Datwyler         2015-03-27  
1120               else if (rc)
91dc182ca6e25e arch/powerpc/kernel/rtas.c Dave C Boutcher        2006-01-13  
1121                       return rc;
91dc182ca6e25e arch/powerpc/kernel/rtas.c Dave C Boutcher        2006-01-13  
1122               goto copy_return;
91dc182ca6e25e arch/powerpc/kernel/rtas.c Dave C Boutcher        2006-01-13  
1123       }
91dc182ca6e25e arch/powerpc/kernel/rtas.c Dave C Boutcher        2006-01-13  
1124  
033ef338b6e007 arch/powerpc/kernel/rtas.c Paul Mackerras         2005-10-26  
1125       buff_copy = get_errorlog_buffer();
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1126  
f97bb36f705da0 arch/powerpc/kernel/rtas.c Benjamin Herrenschmidt 2009-06-16  
1127       flags = lock_rtas();
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1128  
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1129       rtas.args = args;
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1130       enter_rtas(__pa(&rtas.args));
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1131       args = rtas.args;
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1132  
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1133       /* A -1 return code indicates that the last command couldn't
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1134          be completed due to a hardware error. */
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1135       if (be32_to_cpu(args.rets[0]) == -1)
033ef338b6e007 arch/powerpc/kernel/rtas.c Paul Mackerras         2005-10-26  
1136               errbuf = __fetch_rtas_last_error(buff_copy);
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1137  
f97bb36f705da0 arch/powerpc/kernel/rtas.c Benjamin Herrenschmidt 2009-06-16  
1138       unlock_rtas(flags);
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1139  
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1140       if (buff_copy) {
033ef338b6e007 arch/powerpc/kernel/rtas.c Paul Mackerras         2005-10-26  
1141               if (errbuf)
033ef338b6e007 arch/powerpc/kernel/rtas.c Paul Mackerras         2005-10-26  
1142                       log_error(errbuf, ERR_TYPE_RTAS_LOG, 0);
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1143               kfree(buff_copy);
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1144       }
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1145  
91dc182ca6e25e arch/powerpc/kernel/rtas.c Dave C Boutcher        2006-01-13  
1146   copy_return:
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1147       /* Copy out args. */
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1148       if (copy_to_user(uargs->args + nargs,
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1149                        args.args + nargs,
599d2870425dcd arch/powerpc/kernel/rtas.c Greg Kurz              2014-03-19  
1150                        nret * sizeof(rtas_arg_t)) != 0)
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1151               return -EFAULT;
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1152  
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1153       return 0;
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1154  }
^1da177e4c3f41 arch/ppc64/kernel/rtas.c   Linus Torvalds         2005-04-16  
1155  

:::::: The code at line 1099 was first introduced by commit
:::::: b79998fc2e1144919b6b02acbd407a5db1f80ac0 powerpc: Zero fill the return 
values of rtas argument buffer

:::::: TO: Nathan Fontenot <[email protected]>
:::::: CC: Paul Mackerras <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to