All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: linux-arch@vger.kernel.org, linux-scsi@vger.kernel.org
Cc: dhowells@redhat.com, Akira Takeuchi <takeuchi.akr@jp.panasonic.com>
Subject: SCSI vs MN10300: Can get_user() be given an array?
Date: Fri, 28 Jun 2013 17:39:33 +0100	[thread overview]
Message-ID: <5885.1372437573@warthog.procyon.org.uk> (raw)


The MN10300 arch is throwing up an error in the SCSI driver and I'm not sure
whether it needs fixing in the arch - in get_user() - or in the SCSI code.

The problem is this line in sg_scsi_ioctl():

	if (get_user(opcode, sic->data))

sic points to the following struct:

	typedef struct scsi_ioctl_command {
		unsigned int inlen;
		unsigned int outlen;
		unsigned char data[0];
	} Scsi_Ioctl_Command;

However, __get_user_check() on MN10300 does this:

	const __typeof__(ptr) __guc_ptr = (ptr);

which fails with:

	block/scsi_ioctl.c:450: error: invalid initializer

The question is what is SCSI actually asking get_user() to do?  As far as I
can tell, gcc thinks that it's being askied to declare some sort of array
here.

Should the SCSI driver be changed to:

	if (get_user(opcode, (unsigned char *)sic->data))

or should the MN10300 arch be changed to morph the array into a pointer,
perhaps with:

	const __typeof__(ptr[0])* __guc_ptr = (ptr);

or:

	const __typeof__(*ptr)* __guc_ptr = (ptr);

David

             reply	other threads:[~2013-06-28 16:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 16:39 David Howells [this message]
2013-06-28 18:16 ` SCSI vs MN10300: Can get_user() be given an array? James Bottomley

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=5885.1372437573@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=takeuchi.akr@jp.panasonic.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.