linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: kbuild-all@lists.01.org,
	Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Ben Widawsky <ben.widawsky@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	linux-kernel@vger.kernel.org
Subject: [cxl-cxl:pending 28/38] drivers/cxl/core/mbox.c:327:5: warning: no previous prototype for 'cxl_query_cmd'
Date: Sat, 14 Aug 2021 10:15:02 +0800	[thread overview]
Message-ID: <202108141054.tP0Ihz6w-lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git pending
head:   fa809cc6feedcd2575b63def7135dfaf066266bb
commit: 3ff01745221f15018b58a075e83bdaf807e38d22 [28/38] cxl/mbox: Move mailbox and other non-PCI specific infrastructure to the core
config: xtensa-randconfig-r004-20210814 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 11.2.0
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/cxl/cxl.git/commit/?id=3ff01745221f15018b58a075e83bdaf807e38d22
        git remote add cxl-cxl https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git
        git fetch --no-tags cxl-cxl pending
        git checkout 3ff01745221f15018b58a075e83bdaf807e38d22
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=xtensa 

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 >>):

>> drivers/cxl/core/mbox.c:327:5: warning: no previous prototype for 'cxl_query_cmd' [-Wmissing-prototypes]
     327 | int cxl_query_cmd(struct cxl_memdev *cxlmd,
         |     ^~~~~~~~~~~~~
>> drivers/cxl/core/mbox.c:452:5: warning: no previous prototype for 'cxl_send_cmd' [-Wmissing-prototypes]
     452 | int cxl_send_cmd(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s)
         |     ^~~~~~~~~~~~
>> drivers/cxl/core/mbox.c:819:13: warning: no previous prototype for 'cxl_mbox_init' [-Wmissing-prototypes]
     819 | void __init cxl_mbox_init(void)
         |             ^~~~~~~~~~~~~
>> drivers/cxl/core/mbox.c:829:6: warning: no previous prototype for 'cxl_mbox_exit' [-Wmissing-prototypes]
     829 | void cxl_mbox_exit(void)
         |      ^~~~~~~~~~~~~


vim +/cxl_query_cmd +327 drivers/cxl/core/mbox.c

   326	
 > 327	int cxl_query_cmd(struct cxl_memdev *cxlmd,
   328			  struct cxl_mem_query_commands __user *q)
   329	{
   330		struct device *dev = &cxlmd->dev;
   331		struct cxl_mem_command *cmd;
   332		u32 n_commands;
   333		int j = 0;
   334	
   335		dev_dbg(dev, "Query IOCTL\n");
   336	
   337		if (get_user(n_commands, &q->n_commands))
   338			return -EFAULT;
   339	
   340		/* returns the total number if 0 elements are requested. */
   341		if (n_commands == 0)
   342			return put_user(cxl_cmd_count, &q->n_commands);
   343	
   344		/*
   345		 * otherwise, return max(n_commands, total commands) cxl_command_info
   346		 * structures.
   347		 */
   348		cxl_for_each_cmd(cmd) {
   349			const struct cxl_command_info *info = &cmd->info;
   350	
   351			if (copy_to_user(&q->commands[j++], info, sizeof(*info)))
   352				return -EFAULT;
   353	
   354			if (j == n_commands)
   355				break;
   356		}
   357	
   358		return 0;
   359	}
   360	
   361	/**
   362	 * handle_mailbox_cmd_from_user() - Dispatch a mailbox command for userspace.
   363	 * @cxlm: The CXL memory device to communicate with.
   364	 * @cmd: The validated command.
   365	 * @in_payload: Pointer to userspace's input payload.
   366	 * @out_payload: Pointer to userspace's output payload.
   367	 * @size_out: (Input) Max payload size to copy out.
   368	 *            (Output) Payload size hardware generated.
   369	 * @retval: Hardware generated return code from the operation.
   370	 *
   371	 * Return:
   372	 *  * %0	- Mailbox transaction succeeded. This implies the mailbox
   373	 *		  protocol completed successfully not that the operation itself
   374	 *		  was successful.
   375	 *  * %-ENOMEM  - Couldn't allocate a bounce buffer.
   376	 *  * %-EFAULT	- Something happened with copy_to/from_user.
   377	 *  * %-EINTR	- Mailbox acquisition interrupted.
   378	 *  * %-EXXX	- Transaction level failures.
   379	 *
   380	 * Creates the appropriate mailbox command and dispatches it on behalf of a
   381	 * userspace request. The input and output payloads are copied between
   382	 * userspace.
   383	 *
   384	 * See cxl_send_cmd().
   385	 */
   386	static int handle_mailbox_cmd_from_user(struct cxl_mem *cxlm,
   387						const struct cxl_mem_command *cmd,
   388						u64 in_payload, u64 out_payload,
   389						s32 *size_out, u32 *retval)
   390	{
   391		struct device *dev = cxlm->dev;
   392		struct cxl_mbox_cmd mbox_cmd = {
   393			.opcode = cmd->opcode,
   394			.size_in = cmd->info.size_in,
   395			.size_out = cmd->info.size_out,
   396		};
   397		int rc;
   398	
   399		if (cmd->info.size_out) {
   400			mbox_cmd.payload_out = kvzalloc(cmd->info.size_out, GFP_KERNEL);
   401			if (!mbox_cmd.payload_out)
   402				return -ENOMEM;
   403		}
   404	
   405		if (cmd->info.size_in) {
   406			mbox_cmd.payload_in = vmemdup_user(u64_to_user_ptr(in_payload),
   407							   cmd->info.size_in);
   408			if (IS_ERR(mbox_cmd.payload_in)) {
   409				kvfree(mbox_cmd.payload_out);
   410				return PTR_ERR(mbox_cmd.payload_in);
   411			}
   412		}
   413	
   414		dev_dbg(dev,
   415			"Submitting %s command for user\n"
   416			"\topcode: %x\n"
   417			"\tsize: %ub\n",
   418			cxl_command_names[cmd->info.id].name, mbox_cmd.opcode,
   419			cmd->info.size_in);
   420	
   421		dev_WARN_ONCE(dev, cmd->info.id == CXL_MEM_COMMAND_ID_RAW,
   422			      "raw command path used\n");
   423	
   424		rc = cxlm->mbox_send(cxlm, &mbox_cmd);
   425		if (rc)
   426			goto out;
   427	
   428		/*
   429		 * @size_out contains the max size that's allowed to be written back out
   430		 * to userspace. While the payload may have written more output than
   431		 * this it will have to be ignored.
   432		 */
   433		if (mbox_cmd.size_out) {
   434			dev_WARN_ONCE(dev, mbox_cmd.size_out > *size_out,
   435				      "Invalid return size\n");
   436			if (copy_to_user(u64_to_user_ptr(out_payload),
   437					 mbox_cmd.payload_out, mbox_cmd.size_out)) {
   438				rc = -EFAULT;
   439				goto out;
   440			}
   441		}
   442	
   443		*size_out = mbox_cmd.size_out;
   444		*retval = mbox_cmd.return_code;
   445	
   446	out:
   447		kvfree(mbox_cmd.payload_in);
   448		kvfree(mbox_cmd.payload_out);
   449		return rc;
   450	}
   451	
 > 452	int cxl_send_cmd(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s)
   453	{
   454		struct cxl_mem *cxlm = cxlmd->cxlm;
   455		struct device *dev = &cxlmd->dev;
   456		struct cxl_send_command send;
   457		struct cxl_mem_command c;
   458		int rc;
   459	
   460		dev_dbg(dev, "Send IOCTL\n");
   461	
   462		if (copy_from_user(&send, s, sizeof(send)))
   463			return -EFAULT;
   464	
   465		rc = cxl_validate_cmd_from_user(cxlmd->cxlm, &send, &c);
   466		if (rc)
   467			return rc;
   468	
   469		/* Prepare to handle a full payload for variable sized output */
   470		if (c.info.size_out < 0)
   471			c.info.size_out = cxlm->payload_size;
   472	
   473		rc = handle_mailbox_cmd_from_user(cxlm, &c, send.in.payload,
   474						  send.out.payload, &send.out.size,
   475						  &send.retval);
   476		if (rc)
   477			return rc;
   478	
   479		if (copy_to_user(s, &send, sizeof(send)))
   480			return -EFAULT;
   481	
   482		return 0;
   483	}
   484	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41002 bytes --]

                 reply	other threads:[~2021-08-14  2:15 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=202108141054.tP0Ihz6w-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=ben.widawsky@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vishal.l.verma@intel.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).