Re: [linux-next:master 4314/4896] drivers/char/ipmi/ipmi_ssif.c:781:3: note: in expansion of macro 'memcpy'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(cc Corey)

On Sun, 22 Dec 2019 04:34:30 +0800 kbuild test robot <lkp@xxxxxxxxx> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   9f8535c5f75f0e23359962527dbfd31478b2cf16
> commit: 933639f5723a15a13e2105603de9e240bae2f546 [4314/4896] init/Kconfig: enable -O3 for all arches
> config: alpha-randconfig-a001-20191222 (attached as .config)
> compiler: alpha-linux-gcc (GCC) 7.5.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         git checkout 933639f5723a15a13e2105603de9e240bae2f546
>         # save the attached .config to linux build tree
>         GCC_VERSION=7.5.0 make.cross ARCH=alpha 
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from include/linux/string.h:20:0,
>                     from include/linux/bitmap.h:9,
>                     from include/linux/nodemask.h:95,
>                     from include/linux/mmzone.h:17,
>                     from include/linux/gfp.h:6,
>                     from include/linux/umh.h:4,
>                     from include/linux/kmod.h:9,
>                     from include/linux/module.h:16,
>                     from drivers/char/ipmi/ipmi_ssif.c:37:
>    drivers/char/ipmi/ipmi_ssif.c: In function 'msg_written_handler':
>    arch/alpha/include/asm/string.h:22:16: warning: argument 2 null where non-null expected [-Wnonnull]
>     #define memcpy __builtin_memcpy
> >> drivers/char/ipmi/ipmi_ssif.c:781:3: note: in expansion of macro 'memcpy'
>       memcpy(msg->rsp, data, msg->rsp_size);
>       ^~~~~~
>    arch/alpha/include/asm/string.h:22:16: note: in a call to built-in function '__builtin_memcpy'
>     #define memcpy __builtin_memcpy
> >> drivers/char/ipmi/ipmi_ssif.c:781:3: note: in expansion of macro 'memcpy'
>       memcpy(msg->rsp, data, msg->rsp_size);
>       ^~~~~~

This looks like a false positive?

			msg_done_handler(ssif_info, -EIO, NULL, 0);

I assume that NULL never gets to the memcpy.

>    fs/io_uring.c: In function 'io_link_timeout_fn
> >> fs/io_uring.c:2831:2: warning: argument 2 null where non-null expected [-Wnonnull]
>      io_put_req_find_next(req, nxt);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    fs/io_uring.c:1036:13: note: in a call to function 'io_put_req_find_next' declared here
>     static void io_put_req_find_next(struct io_kiocb *req, struct io_kiocb **nxtptr)
>                 ^~~~~~~~~~~~~~~~~~~~
> 
> vim +/memcpy +781 drivers/char/ipmi/ipmi_ssif.c
> 
> 259307074bfcf1 Corey Minyard   2012-03-19  622  
> 259307074bfcf1 Corey Minyard   2012-03-19  623  static void msg_done_handler(struct ssif_info *ssif_info, int result,
> 259307074bfcf1 Corey Minyard   2012-03-19  624  			     unsigned char *data, unsigned int len)
> 259307074bfcf1 Corey Minyard   2012-03-19  625  {
> 259307074bfcf1 Corey Minyard   2012-03-19  626  	struct ipmi_smi_msg *msg;
> 259307074bfcf1 Corey Minyard   2012-03-19  627  	unsigned long oflags, *flags;
> 259307074bfcf1 Corey Minyard   2012-03-19  628  	int rv;
> 259307074bfcf1 Corey Minyard   2012-03-19  629  
> 259307074bfcf1 Corey Minyard   2012-03-19  630  	/*
> 259307074bfcf1 Corey Minyard   2012-03-19  631  	 * We are single-threaded here, so no need for a lock until we
> 259307074bfcf1 Corey Minyard   2012-03-19  632  	 * start messing with driver states or the queues.
> 259307074bfcf1 Corey Minyard   2012-03-19  633  	 */
> 259307074bfcf1 Corey Minyard   2012-03-19  634  
> 259307074bfcf1 Corey Minyard   2012-03-19  635  	if (result < 0) {
> 259307074bfcf1 Corey Minyard   2012-03-19  636  		ssif_info->retries_left--;
> 259307074bfcf1 Corey Minyard   2012-03-19  637  		if (ssif_info->retries_left > 0) {
> 259307074bfcf1 Corey Minyard   2012-03-19  638  			ssif_inc_stat(ssif_info, receive_retries);
> 259307074bfcf1 Corey Minyard   2012-03-19  639  
> 9162052173d238 Corey Minyard   2015-04-24  640  			flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
> 9162052173d238 Corey Minyard   2015-04-24  641  			ssif_info->waiting_alert = true;
> 9162052173d238 Corey Minyard   2015-04-24  642  			ssif_info->rtc_us_timer = SSIF_MSG_USEC;
> 0711e8c1b4572d Jan Glauber     2018-10-11  643  			if (!ssif_info->stopping)
> 259307074bfcf1 Corey Minyard   2012-03-19  644  				mod_timer(&ssif_info->retry_timer,
> 259307074bfcf1 Corey Minyard   2012-03-19  645  					  jiffies + SSIF_MSG_JIFFIES);
> 9162052173d238 Corey Minyard   2015-04-24  646  			ipmi_ssif_unlock_cond(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  647  			return;
> 259307074bfcf1 Corey Minyard   2012-03-19  648  		}
> 259307074bfcf1 Corey Minyard   2012-03-19  649  
> 259307074bfcf1 Corey Minyard   2012-03-19  650  		ssif_inc_stat(ssif_info, receive_errors);
> 259307074bfcf1 Corey Minyard   2012-03-19  651  
> 259307074bfcf1 Corey Minyard   2012-03-19  652  		if  (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
> 83af41947c5cbd Corey Minyard   2018-11-27  653  			dev_dbg(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  654  				"%s: Error %d\n", __func__, result);
> 259307074bfcf1 Corey Minyard   2012-03-19  655  		len = 0;
> 259307074bfcf1 Corey Minyard   2012-03-19  656  		goto continue_op;
> 259307074bfcf1 Corey Minyard   2012-03-19  657  	}
> 259307074bfcf1 Corey Minyard   2012-03-19  658  
> 259307074bfcf1 Corey Minyard   2012-03-19  659  	if ((len > 1) && (ssif_info->multi_pos == 0)
> 259307074bfcf1 Corey Minyard   2012-03-19  660  				&& (data[0] == 0x00) && (data[1] == 0x01)) {
> 259307074bfcf1 Corey Minyard   2012-03-19  661  		/* Start of multi-part read.  Start the next transaction. */
> 259307074bfcf1 Corey Minyard   2012-03-19  662  		int i;
> 259307074bfcf1 Corey Minyard   2012-03-19  663  
> 259307074bfcf1 Corey Minyard   2012-03-19  664  		ssif_inc_stat(ssif_info, received_message_parts);
> 259307074bfcf1 Corey Minyard   2012-03-19  665  
> 259307074bfcf1 Corey Minyard   2012-03-19  666  		/* Remove the multi-part read marker. */
> 259307074bfcf1 Corey Minyard   2012-03-19  667  		len -= 2;
> 7d6380cd40f799 Corey Minyard   2018-11-16  668  		data += 2;
> 3d69d43baa2749 Corey Minyard   2015-04-29  669  		for (i = 0; i < len; i++)
> 7d6380cd40f799 Corey Minyard   2018-11-16  670  			ssif_info->data[i] = data[i];
> 259307074bfcf1 Corey Minyard   2012-03-19  671  		ssif_info->multi_len = len;
> 259307074bfcf1 Corey Minyard   2012-03-19  672  		ssif_info->multi_pos = 1;
> 259307074bfcf1 Corey Minyard   2012-03-19  673  
> 259307074bfcf1 Corey Minyard   2012-03-19  674  		rv = ssif_i2c_send(ssif_info, msg_done_handler, I2C_SMBUS_READ,
> 259307074bfcf1 Corey Minyard   2012-03-19  675  				  SSIF_IPMI_MULTI_PART_RESPONSE_MIDDLE,
> 259307074bfcf1 Corey Minyard   2012-03-19  676  				  ssif_info->recv, I2C_SMBUS_BLOCK_DATA);
> 259307074bfcf1 Corey Minyard   2012-03-19  677  		if (rv < 0) {
> 259307074bfcf1 Corey Minyard   2012-03-19  678  			if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
> 83af41947c5cbd Corey Minyard   2018-11-27  679  				dev_dbg(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  680  					"Error from i2c_non_blocking_op(1)\n");
> 259307074bfcf1 Corey Minyard   2012-03-19  681  
> 259307074bfcf1 Corey Minyard   2012-03-19  682  			result = -EIO;
> 259307074bfcf1 Corey Minyard   2012-03-19  683  		} else
> 259307074bfcf1 Corey Minyard   2012-03-19  684  			return;
> 259307074bfcf1 Corey Minyard   2012-03-19  685  	} else if (ssif_info->multi_pos) {
> 259307074bfcf1 Corey Minyard   2012-03-19  686  		/* Middle of multi-part read.  Start the next transaction. */
> 259307074bfcf1 Corey Minyard   2012-03-19  687  		int i;
> 259307074bfcf1 Corey Minyard   2012-03-19  688  		unsigned char blocknum;
> 259307074bfcf1 Corey Minyard   2012-03-19  689  
> 259307074bfcf1 Corey Minyard   2012-03-19  690  		if (len == 0) {
> 259307074bfcf1 Corey Minyard   2012-03-19  691  			result = -EIO;
> 259307074bfcf1 Corey Minyard   2012-03-19  692  			if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
> 83af41947c5cbd Corey Minyard   2018-11-27  693  				dev_dbg(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  694  					"Middle message with no data\n");
> 259307074bfcf1 Corey Minyard   2012-03-19  695  
> 259307074bfcf1 Corey Minyard   2012-03-19  696  			goto continue_op;
> 259307074bfcf1 Corey Minyard   2012-03-19  697  		}
> 259307074bfcf1 Corey Minyard   2012-03-19  698  
> 3d69d43baa2749 Corey Minyard   2015-04-29  699  		blocknum = data[0];
> 7d6380cd40f799 Corey Minyard   2018-11-16  700  		len--;
> 7d6380cd40f799 Corey Minyard   2018-11-16  701  		data++;
> 7d6380cd40f799 Corey Minyard   2018-11-16  702  
> 7d6380cd40f799 Corey Minyard   2018-11-16  703  		if (blocknum != 0xff && len != 31) {
> 7d6380cd40f799 Corey Minyard   2018-11-16  704  		    /* All blocks but the last must have 31 data bytes. */
> 7d6380cd40f799 Corey Minyard   2018-11-16  705  			result = -EIO;
> 7d6380cd40f799 Corey Minyard   2018-11-16  706  			if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
> 83af41947c5cbd Corey Minyard   2018-11-27  707  				dev_dbg(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  708  					"Received middle message <31\n");
> 259307074bfcf1 Corey Minyard   2012-03-19  709  
> 7d6380cd40f799 Corey Minyard   2018-11-16  710  			goto continue_op;
> 7d6380cd40f799 Corey Minyard   2018-11-16  711  		}
> 7d6380cd40f799 Corey Minyard   2018-11-16  712  
> 7d6380cd40f799 Corey Minyard   2018-11-16  713  		if (ssif_info->multi_len + len > IPMI_MAX_MSG_LENGTH) {
> 259307074bfcf1 Corey Minyard   2012-03-19  714  			/* Received message too big, abort the operation. */
> 259307074bfcf1 Corey Minyard   2012-03-19  715  			result = -E2BIG;
> 259307074bfcf1 Corey Minyard   2012-03-19  716  			if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
> 83af41947c5cbd Corey Minyard   2018-11-27  717  				dev_dbg(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  718  					"Received message too big\n");
> 259307074bfcf1 Corey Minyard   2012-03-19  719  
> 259307074bfcf1 Corey Minyard   2012-03-19  720  			goto continue_op;
> 259307074bfcf1 Corey Minyard   2012-03-19  721  		}
> 259307074bfcf1 Corey Minyard   2012-03-19  722  
> 3d69d43baa2749 Corey Minyard   2015-04-29  723  		for (i = 0; i < len; i++)
> 7d6380cd40f799 Corey Minyard   2018-11-16  724  			ssif_info->data[i + ssif_info->multi_len] = data[i];
> 259307074bfcf1 Corey Minyard   2012-03-19  725  		ssif_info->multi_len += len;
> 259307074bfcf1 Corey Minyard   2012-03-19  726  		if (blocknum == 0xff) {
> 259307074bfcf1 Corey Minyard   2012-03-19  727  			/* End of read */
> 259307074bfcf1 Corey Minyard   2012-03-19  728  			len = ssif_info->multi_len;
> 259307074bfcf1 Corey Minyard   2012-03-19  729  			data = ssif_info->data;
> 55be8658c7e2fe Kamlakant Patel 2019-04-24  730  		} else if (blocknum + 1 != ssif_info->multi_pos) {
> 259307074bfcf1 Corey Minyard   2012-03-19  731  			/*
> 259307074bfcf1 Corey Minyard   2012-03-19  732  			 * Out of sequence block, just abort.  Block
> 259307074bfcf1 Corey Minyard   2012-03-19  733  			 * numbers start at zero for the second block,
> 259307074bfcf1 Corey Minyard   2012-03-19  734  			 * but multi_pos starts at one, so the +1.
> 259307074bfcf1 Corey Minyard   2012-03-19  735  			 */
> 55be8658c7e2fe Kamlakant Patel 2019-04-24  736  			if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
> 55be8658c7e2fe Kamlakant Patel 2019-04-24  737  				dev_dbg(&ssif_info->client->dev,
> 55be8658c7e2fe Kamlakant Patel 2019-04-24  738  					"Received message out of sequence, expected %u, got %u\n",
> 55be8658c7e2fe Kamlakant Patel 2019-04-24  739  					ssif_info->multi_pos - 1, blocknum);
> 259307074bfcf1 Corey Minyard   2012-03-19  740  			result = -EIO;
> 259307074bfcf1 Corey Minyard   2012-03-19  741  		} else {
> 259307074bfcf1 Corey Minyard   2012-03-19  742  			ssif_inc_stat(ssif_info, received_message_parts);
> 259307074bfcf1 Corey Minyard   2012-03-19  743  
> 259307074bfcf1 Corey Minyard   2012-03-19  744  			ssif_info->multi_pos++;
> 259307074bfcf1 Corey Minyard   2012-03-19  745  
> 259307074bfcf1 Corey Minyard   2012-03-19  746  			rv = ssif_i2c_send(ssif_info, msg_done_handler,
> 259307074bfcf1 Corey Minyard   2012-03-19  747  					   I2C_SMBUS_READ,
> 259307074bfcf1 Corey Minyard   2012-03-19  748  					   SSIF_IPMI_MULTI_PART_RESPONSE_MIDDLE,
> 259307074bfcf1 Corey Minyard   2012-03-19  749  					   ssif_info->recv,
> 259307074bfcf1 Corey Minyard   2012-03-19  750  					   I2C_SMBUS_BLOCK_DATA);
> 259307074bfcf1 Corey Minyard   2012-03-19  751  			if (rv < 0) {
> 259307074bfcf1 Corey Minyard   2012-03-19  752  				if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
> 83af41947c5cbd Corey Minyard   2018-11-27  753  					dev_dbg(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  754  						"Error from ssif_i2c_send\n");
> 259307074bfcf1 Corey Minyard   2012-03-19  755  
> 259307074bfcf1 Corey Minyard   2012-03-19  756  				result = -EIO;
> 259307074bfcf1 Corey Minyard   2012-03-19  757  			} else
> 259307074bfcf1 Corey Minyard   2012-03-19  758  				return;
> 259307074bfcf1 Corey Minyard   2012-03-19  759  		}
> 259307074bfcf1 Corey Minyard   2012-03-19  760  	}
> 259307074bfcf1 Corey Minyard   2012-03-19  761  
> 7d6380cd40f799 Corey Minyard   2018-11-16  762   continue_op:
> 259307074bfcf1 Corey Minyard   2012-03-19  763  	if (result < 0) {
> 259307074bfcf1 Corey Minyard   2012-03-19  764  		ssif_inc_stat(ssif_info, receive_errors);
> 259307074bfcf1 Corey Minyard   2012-03-19  765  	} else {
> 259307074bfcf1 Corey Minyard   2012-03-19  766  		ssif_inc_stat(ssif_info, received_messages);
> 259307074bfcf1 Corey Minyard   2012-03-19  767  		ssif_inc_stat(ssif_info, received_message_parts);
> 259307074bfcf1 Corey Minyard   2012-03-19  768  	}
> 259307074bfcf1 Corey Minyard   2012-03-19  769  
> 259307074bfcf1 Corey Minyard   2012-03-19  770  	if (ssif_info->ssif_debug & SSIF_DEBUG_STATE)
> 83af41947c5cbd Corey Minyard   2018-11-27  771  		dev_dbg(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  772  			"DONE 1: state = %d, result=%d\n",
> 259307074bfcf1 Corey Minyard   2012-03-19  773  			ssif_info->ssif_state, result);
> 259307074bfcf1 Corey Minyard   2012-03-19  774  
> 259307074bfcf1 Corey Minyard   2012-03-19  775  	flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
> 259307074bfcf1 Corey Minyard   2012-03-19  776  	msg = ssif_info->curr_msg;
> 259307074bfcf1 Corey Minyard   2012-03-19  777  	if (msg) {
> 259307074bfcf1 Corey Minyard   2012-03-19  778  		msg->rsp_size = len;
> 259307074bfcf1 Corey Minyard   2012-03-19  779  		if (msg->rsp_size > IPMI_MAX_MSG_LENGTH)
> 259307074bfcf1 Corey Minyard   2012-03-19  780  			msg->rsp_size = IPMI_MAX_MSG_LENGTH;
> 259307074bfcf1 Corey Minyard   2012-03-19 @781  		memcpy(msg->rsp, data, msg->rsp_size);
> 259307074bfcf1 Corey Minyard   2012-03-19  782  		ssif_info->curr_msg = NULL;
> 259307074bfcf1 Corey Minyard   2012-03-19  783  	}
> 259307074bfcf1 Corey Minyard   2012-03-19  784  
> 259307074bfcf1 Corey Minyard   2012-03-19  785  	switch (ssif_info->ssif_state) {
> 259307074bfcf1 Corey Minyard   2012-03-19  786  	case SSIF_NORMAL:
> 259307074bfcf1 Corey Minyard   2012-03-19  787  		ipmi_ssif_unlock_cond(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  788  		if (!msg)
> 259307074bfcf1 Corey Minyard   2012-03-19  789  			break;
> 259307074bfcf1 Corey Minyard   2012-03-19  790  
> 259307074bfcf1 Corey Minyard   2012-03-19  791  		if (result < 0)
> 259307074bfcf1 Corey Minyard   2012-03-19  792  			return_hosed_msg(ssif_info, msg);
> 259307074bfcf1 Corey Minyard   2012-03-19  793  		else
> 259307074bfcf1 Corey Minyard   2012-03-19  794  			deliver_recv_msg(ssif_info, msg);
> 259307074bfcf1 Corey Minyard   2012-03-19  795  		break;
> 259307074bfcf1 Corey Minyard   2012-03-19  796  
> 259307074bfcf1 Corey Minyard   2012-03-19  797  	case SSIF_GETTING_FLAGS:
> 259307074bfcf1 Corey Minyard   2012-03-19  798  		/* We got the flags from the SSIF, now handle them. */
> 259307074bfcf1 Corey Minyard   2012-03-19  799  		if ((result < 0) || (len < 4) || (data[2] != 0)) {
> 259307074bfcf1 Corey Minyard   2012-03-19  800  			/*
> 259307074bfcf1 Corey Minyard   2012-03-19  801  			 * Error fetching flags, or invalid length,
> 259307074bfcf1 Corey Minyard   2012-03-19  802  			 * just give up for now.
> 259307074bfcf1 Corey Minyard   2012-03-19  803  			 */
> 259307074bfcf1 Corey Minyard   2012-03-19  804  			ssif_info->ssif_state = SSIF_NORMAL;
> 259307074bfcf1 Corey Minyard   2012-03-19  805  			ipmi_ssif_unlock_cond(ssif_info, flags);
> 83af41947c5cbd Corey Minyard   2018-11-27  806  			dev_warn(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  807  				 "Error getting flags: %d %d, %x\n",
> f002612b9d8661 Kamlakant Patel 2018-03-13  808  				 result, len, (len >= 3) ? data[2] : 0);
> 259307074bfcf1 Corey Minyard   2012-03-19  809  		} else if (data[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2
> 259307074bfcf1 Corey Minyard   2012-03-19  810  			   || data[1] != IPMI_GET_MSG_FLAGS_CMD) {
> 4495ec6d770e1b Corey Minyard   2017-06-30  811  			/*
> 4495ec6d770e1b Corey Minyard   2017-06-30  812  			 * Don't abort here, maybe it was a queued
> 4495ec6d770e1b Corey Minyard   2017-06-30  813  			 * response to a previous command.
> 4495ec6d770e1b Corey Minyard   2017-06-30  814  			 */
> 4495ec6d770e1b Corey Minyard   2017-06-30  815  			ipmi_ssif_unlock_cond(ssif_info, flags);
> 83af41947c5cbd Corey Minyard   2018-11-27  816  			dev_warn(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  817  				 "Invalid response getting flags: %x %x\n",
> 259307074bfcf1 Corey Minyard   2012-03-19  818  				 data[0], data[1]);
> 259307074bfcf1 Corey Minyard   2012-03-19  819  		} else {
> 259307074bfcf1 Corey Minyard   2012-03-19  820  			ssif_inc_stat(ssif_info, flag_fetches);
> 259307074bfcf1 Corey Minyard   2012-03-19  821  			ssif_info->msg_flags = data[3];
> 259307074bfcf1 Corey Minyard   2012-03-19  822  			handle_flags(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  823  		}
> 259307074bfcf1 Corey Minyard   2012-03-19  824  		break;
> 259307074bfcf1 Corey Minyard   2012-03-19  825  
> 259307074bfcf1 Corey Minyard   2012-03-19  826  	case SSIF_CLEARING_FLAGS:
> 259307074bfcf1 Corey Minyard   2012-03-19  827  		/* We cleared the flags. */
> 259307074bfcf1 Corey Minyard   2012-03-19  828  		if ((result < 0) || (len < 3) || (data[2] != 0)) {
> 259307074bfcf1 Corey Minyard   2012-03-19  829  			/* Error clearing flags */
> 83af41947c5cbd Corey Minyard   2018-11-27  830  			dev_warn(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  831  				 "Error clearing flags: %d %d, %x\n",
> f002612b9d8661 Kamlakant Patel 2018-03-13  832  				 result, len, (len >= 3) ? data[2] : 0);
> 259307074bfcf1 Corey Minyard   2012-03-19  833  		} else if (data[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2
> 259307074bfcf1 Corey Minyard   2012-03-19  834  			   || data[1] != IPMI_CLEAR_MSG_FLAGS_CMD) {
> 83af41947c5cbd Corey Minyard   2018-11-27  835  			dev_warn(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  836  				 "Invalid response clearing flags: %x %x\n",
> 259307074bfcf1 Corey Minyard   2012-03-19  837  				 data[0], data[1]);
> 259307074bfcf1 Corey Minyard   2012-03-19  838  		}
> 259307074bfcf1 Corey Minyard   2012-03-19  839  		ssif_info->ssif_state = SSIF_NORMAL;
> 259307074bfcf1 Corey Minyard   2012-03-19  840  		ipmi_ssif_unlock_cond(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  841  		break;
> 259307074bfcf1 Corey Minyard   2012-03-19  842  
> 259307074bfcf1 Corey Minyard   2012-03-19  843  	case SSIF_GETTING_EVENTS:
> 259307074bfcf1 Corey Minyard   2012-03-19  844  		if ((result < 0) || (len < 3) || (msg->rsp[2] != 0)) {
> 259307074bfcf1 Corey Minyard   2012-03-19  845  			/* Error getting event, probably done. */
> 259307074bfcf1 Corey Minyard   2012-03-19  846  			msg->done(msg);
> 259307074bfcf1 Corey Minyard   2012-03-19  847  
> 259307074bfcf1 Corey Minyard   2012-03-19  848  			/* Take off the event flag. */
> 259307074bfcf1 Corey Minyard   2012-03-19  849  			ssif_info->msg_flags &= ~EVENT_MSG_BUFFER_FULL;
> 259307074bfcf1 Corey Minyard   2012-03-19  850  			handle_flags(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  851  		} else if (msg->rsp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2
> 259307074bfcf1 Corey Minyard   2012-03-19  852  			   || msg->rsp[1] != IPMI_READ_EVENT_MSG_BUFFER_CMD) {
> 83af41947c5cbd Corey Minyard   2018-11-27  853  			dev_warn(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  854  				 "Invalid response getting events: %x %x\n",
> 259307074bfcf1 Corey Minyard   2012-03-19  855  				 msg->rsp[0], msg->rsp[1]);
> 259307074bfcf1 Corey Minyard   2012-03-19  856  			msg->done(msg);
> 259307074bfcf1 Corey Minyard   2012-03-19  857  			/* Take off the event flag. */
> 259307074bfcf1 Corey Minyard   2012-03-19  858  			ssif_info->msg_flags &= ~EVENT_MSG_BUFFER_FULL;
> 259307074bfcf1 Corey Minyard   2012-03-19  859  			handle_flags(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  860  		} else {
> 259307074bfcf1 Corey Minyard   2012-03-19  861  			handle_flags(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  862  			ssif_inc_stat(ssif_info, events);
> 259307074bfcf1 Corey Minyard   2012-03-19  863  			deliver_recv_msg(ssif_info, msg);
> 259307074bfcf1 Corey Minyard   2012-03-19  864  		}
> 259307074bfcf1 Corey Minyard   2012-03-19  865  		break;
> 259307074bfcf1 Corey Minyard   2012-03-19  866  
> 259307074bfcf1 Corey Minyard   2012-03-19  867  	case SSIF_GETTING_MESSAGES:
> 259307074bfcf1 Corey Minyard   2012-03-19  868  		if ((result < 0) || (len < 3) || (msg->rsp[2] != 0)) {
> 259307074bfcf1 Corey Minyard   2012-03-19  869  			/* Error getting event, probably done. */
> 259307074bfcf1 Corey Minyard   2012-03-19  870  			msg->done(msg);
> 259307074bfcf1 Corey Minyard   2012-03-19  871  
> 259307074bfcf1 Corey Minyard   2012-03-19  872  			/* Take off the msg flag. */
> 259307074bfcf1 Corey Minyard   2012-03-19  873  			ssif_info->msg_flags &= ~RECEIVE_MSG_AVAIL;
> 259307074bfcf1 Corey Minyard   2012-03-19  874  			handle_flags(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  875  		} else if (msg->rsp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2
> 259307074bfcf1 Corey Minyard   2012-03-19  876  			   || msg->rsp[1] != IPMI_GET_MSG_CMD) {
> 83af41947c5cbd Corey Minyard   2018-11-27  877  			dev_warn(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  878  				 "Invalid response clearing flags: %x %x\n",
> 259307074bfcf1 Corey Minyard   2012-03-19  879  				 msg->rsp[0], msg->rsp[1]);
> 259307074bfcf1 Corey Minyard   2012-03-19  880  			msg->done(msg);
> 259307074bfcf1 Corey Minyard   2012-03-19  881  
> 259307074bfcf1 Corey Minyard   2012-03-19  882  			/* Take off the msg flag. */
> 259307074bfcf1 Corey Minyard   2012-03-19  883  			ssif_info->msg_flags &= ~RECEIVE_MSG_AVAIL;
> 259307074bfcf1 Corey Minyard   2012-03-19  884  			handle_flags(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  885  		} else {
> 259307074bfcf1 Corey Minyard   2012-03-19  886  			ssif_inc_stat(ssif_info, incoming_messages);
> 259307074bfcf1 Corey Minyard   2012-03-19  887  			handle_flags(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  888  			deliver_recv_msg(ssif_info, msg);
> 259307074bfcf1 Corey Minyard   2012-03-19  889  		}
> 259307074bfcf1 Corey Minyard   2012-03-19  890  		break;
> 259307074bfcf1 Corey Minyard   2012-03-19  891  	}
> 259307074bfcf1 Corey Minyard   2012-03-19  892  
> 259307074bfcf1 Corey Minyard   2012-03-19  893  	flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
> 259307074bfcf1 Corey Minyard   2012-03-19  894  	if (SSIF_IDLE(ssif_info) && !ssif_info->stopping) {
> 259307074bfcf1 Corey Minyard   2012-03-19  895  		if (ssif_info->req_events)
> 259307074bfcf1 Corey Minyard   2012-03-19  896  			start_event_fetch(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  897  		else if (ssif_info->req_flags)
> 259307074bfcf1 Corey Minyard   2012-03-19  898  			start_flag_fetch(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  899  		else
> 259307074bfcf1 Corey Minyard   2012-03-19  900  			start_next_msg(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  901  	} else
> 259307074bfcf1 Corey Minyard   2012-03-19  902  		ipmi_ssif_unlock_cond(ssif_info, flags);
> 259307074bfcf1 Corey Minyard   2012-03-19  903  
> 259307074bfcf1 Corey Minyard   2012-03-19  904  	if (ssif_info->ssif_debug & SSIF_DEBUG_STATE)
> 83af41947c5cbd Corey Minyard   2018-11-27  905  		dev_dbg(&ssif_info->client->dev,
> 83af41947c5cbd Corey Minyard   2018-11-27  906  			"DONE 2: state = %d.\n", ssif_info->ssif_state);
> 259307074bfcf1 Corey Minyard   2012-03-19  907  }
> 259307074bfcf1 Corey Minyard   2012-03-19  908  
> 
> :::::: The code at line 781 was first introduced by commit
> :::::: 259307074bfcf1ff88016e12c68f057aee6cb694 ipmi: Add SMBus interface driver (SSIF)
> 
> :::::: TO: Corey Minyard <cminyard@xxxxxxxxxx>
> :::::: CC: Corey Minyard <cminyard@xxxxxxxxxx>
> 
> ---
> 0-DAY kernel test infrastructure                 Open Source Technology Center
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux