linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Douglas Gilbert <dgilbert@interlog.com>
Cc: linux-scsi@vger.kernel.org,
	James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com, bart.vanassche@sandisk.com,
	hch@infradead.org
Subject: Re: [PATCH v2] scsi_debug: fix sleep in invalid context
Date: Tue, 7 Jun 2016 04:55:25 -0700	[thread overview]
Message-ID: <20160607115525.GA30861@infradead.org> (raw)
In-Reply-To: <1464729307-22182-1-git-send-email-dgilbert@interlog.com>

> +static int p_fill_from_dev_buffer(struct scsi_cmnd *scp, const void *arr,
> +				  int arr_len, unsigned int off_dst)
> +{
> +	int act_len, n;
> +	struct scsi_data_buffer *sdb = scsi_in(scp);
> +	off_t skip = off_dst;

Why off_t which is a signed value instead of the unsigned in passed in?

> +#define RL_BUCKET_ELEMS 8
> +
>  /* Even though each pseudo target has a REPORT LUNS "well known logical unit"
>   * (W-LUN), the normal Linux scanning logic does not associate it with a
>   * device (e.g. /dev/sg7). The following magic will make that association:
> @@ -3285,12 +3315,14 @@ static int resp_report_luns(struct scsi_cmnd *scp,
>  	unsigned char select_report;
>  	u64 lun;
>  	struct scsi_lun *lun_p;
> -	u8 *arr;
> +	u8 arr[RL_BUCKET_ELEMS * sizeof(struct scsi_lun)];

just use an on-stack array of type struct scsi_lun here, e.g.:

	struct scsi_lun arr[RL_BUCKET_ELEMS];

Which you can then use directly instead of lun_p later, but which can
also be passed p_fill_from_dev_buffer as that takes a void pointer.

  parent reply	other threads:[~2016-06-07 11:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31 21:15 [PATCH v2] scsi_debug: fix sleep in invalid context Douglas Gilbert
2016-06-07  3:17 ` Martin K. Petersen
2016-06-07 11:55 ` Christoph Hellwig [this message]
2016-06-08  6:57   ` Douglas Gilbert
2016-06-09  5:18     ` Douglas Gilbert
2016-06-09  9:14       ` Christoph Hellwig
2016-06-09 16:25 ` Bart Van Assche
2016-06-15  1:54 ` Martin K. Petersen

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=20160607115525.GA30861@infradead.org \
    --to=hch@infradead.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=dgilbert@interlog.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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).