Subject: Re: linux-next: build failure after merge of the scsi tree

From: Hannes Reinecke <[email-masked]>
Date: Tue, 04 Nov 2014 08:07:51 +0100

On 11/04/2014 05:43 AM, Stephen Rothwell wrote:
> Hi James,
> 
> After merging the scsi tree, today's linux-next build (arm 
> multi_v7_defconfig) failed like this:
> 
> In file included from include/linux/sched.h:17:0, from
> include/linux/blkdev.h:4, from drivers/scsi/constants.c:10: 
> drivers/scsi/constants.c: In function 'scsi_opcode_sa_name': 
> include/linux/kernel.h:54:32: error: invalid application of
> 'sizeof' to incomplete type 'const char *[]' #define
> ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +
> __must_be_array(arr)) ^ drivers/scsi/constants.c:300:15: note:
> in expansion of macro 'ARRAY_SIZE' if (opcode <
> ARRAY_SIZE(cdb_byte0_names)) ^
> 
> Caused by 94bafab0008c ("scsi: consolidate opcode lookup in 
> scsi_opcode_sa_name()").  This build does not have 
> CONFIG_SCSI_CONSTANTS set.
> 
> I have used the scsi tree from next-20141031 again (since
> yesterday's tree had a different build problem).
> 
Sorry. Here's the patch.

Cheers,

Hannes
- -- 
Dr. Hannes Reinecke		      zSeries & Storage
[email-masked]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
>>From 355eac426aea2e1f98b99a41707b37e9ba3ef02b Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <[email-masked]>
Date: Tue, 4 Nov 2014 08:06:03 +0100
Subject: [PATCH] scsi: Fixup compilation warning when SCSI_CONSTANTS is not
 set

ARRAY_SIZE() requires the array to actually have a size.

Signed-off-by: Hannes Reinecke <[email-masked]>
---
 drivers/scsi/constants.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index b3cbf3a..a1a7fca 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -267,7 +267,7 @@ static struct sa_name_list sa_names_arr[] = {
 };
 
 #else /* ifndef CONFIG_SCSI_CONSTANTS */
-static const char *cdb_byte0_names[];
+static const char *cdb_byte0_names[0];
 
 static struct sa_name_list sa_names_arr[] = {
 	{VARIABLE_LENGTH_CMD, NULL, 0},
-- 
1.8.5.2