scsi: scsi_debug: Allocate the MODE SENSE response from the heap
Make the MODE SENSE response buffer larger and allocate it from the heap. This patch prepares for adding support for the IO Advice Hints Grouping mode page. Suggested-by: Douglas Gilbert <dgilbert@interlog.com> Cc: Douglas Gilbert <dgilbert@interlog.com> Tested-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20240130214911.1863909-17-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
f19c3e4fe2
commit
b952eb270d
1 changed files with 7 additions and 2 deletions
|
@ -43,6 +43,7 @@
|
||||||
#include <linux/prefetch.h>
|
#include <linux/prefetch.h>
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/async.h>
|
#include <linux/async.h>
|
||||||
|
#include <linux/cleanup.h>
|
||||||
|
|
||||||
#include <net/checksum.h>
|
#include <net/checksum.h>
|
||||||
|
|
||||||
|
@ -2631,7 +2632,8 @@ static int resp_sas_sha_m_spg(unsigned char *p, int pcontrol)
|
||||||
return sizeof(sas_sha_m_pg);
|
return sizeof(sas_sha_m_pg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SDEBUG_MAX_MSENSE_SZ 256
|
/* PAGE_SIZE is more than necessary but provides room for future expansion. */
|
||||||
|
#define SDEBUG_MAX_MSENSE_SZ PAGE_SIZE
|
||||||
|
|
||||||
static int resp_mode_sense(struct scsi_cmnd *scp,
|
static int resp_mode_sense(struct scsi_cmnd *scp,
|
||||||
struct sdebug_dev_info *devip)
|
struct sdebug_dev_info *devip)
|
||||||
|
@ -2642,10 +2644,13 @@ static int resp_mode_sense(struct scsi_cmnd *scp,
|
||||||
int target_dev_id;
|
int target_dev_id;
|
||||||
int target = scp->device->id;
|
int target = scp->device->id;
|
||||||
unsigned char *ap;
|
unsigned char *ap;
|
||||||
unsigned char arr[SDEBUG_MAX_MSENSE_SZ];
|
unsigned char *arr __free(kfree);
|
||||||
unsigned char *cmd = scp->cmnd;
|
unsigned char *cmd = scp->cmnd;
|
||||||
bool dbd, llbaa, msense_6, is_disk, is_zbc;
|
bool dbd, llbaa, msense_6, is_disk, is_zbc;
|
||||||
|
|
||||||
|
arr = kzalloc(SDEBUG_MAX_MSENSE_SZ, GFP_ATOMIC);
|
||||||
|
if (!arr)
|
||||||
|
return -ENOMEM;
|
||||||
dbd = !!(cmd[1] & 0x8); /* disable block descriptors */
|
dbd = !!(cmd[1] & 0x8); /* disable block descriptors */
|
||||||
pcontrol = (cmd[2] & 0xc0) >> 6;
|
pcontrol = (cmd[2] & 0xc0) >> 6;
|
||||||
pcode = cmd[2] & 0x3f;
|
pcode = cmd[2] & 0x3f;
|
||||||
|
|
Loading…
Add table
Reference in a new issue