浏览代码

powerpc/pseries/hvcserver: don't memset pi_buff if it is null

pi_buff is being memset before it is sanity checked. Move the
memset after the null pi_buff sanity check to avoid an oops.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Colin Ian King 9 年之前
父节点
当前提交
c13e1c05b2
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      arch/powerpc/platforms/pseries/hvcserver.c

+ 1 - 1
arch/powerpc/platforms/pseries/hvcserver.c

@@ -142,11 +142,11 @@ int hvcs_get_partner_info(uint32_t unit_address, struct list_head *head,
 	int more = 1;
 	int retval;
 
-	memset(pi_buff, 0x00, PAGE_SIZE);
 	/* invalid parameters */
 	if (!head || !pi_buff)
 		return -EINVAL;
 
+	memset(pi_buff, 0x00, PAGE_SIZE);
 	last_p_partition_ID = last_p_unit_address = ~0UL;
 	INIT_LIST_HEAD(head);