mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-20 22:26:23 +00:00
Fix incorrect "Access beyond the end of the device" reporting for INQUIRY on vcdroms without disk
Reported and suggested how to fix it by Bart Van Assche <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4309 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1189,8 +1189,12 @@ static bool vdisk_parse_offset(struct vdisk_cmd_params *p, struct scst_cmd *cmd)
|
||||
(long long unsigned int)lba_start,
|
||||
(long long unsigned int)loff,
|
||||
(long long unsigned int)data_len);
|
||||
if (unlikely(loff < 0) || unlikely(data_len < 0) ||
|
||||
unlikely((loff + data_len) > virt_dev->file_size)) {
|
||||
|
||||
EXTRACHECKS_BUG_ON((loff < 0) || unlikely(data_len < 0));
|
||||
|
||||
/* If lba_len is 0, loff doesn't make sense, so this error not possible */
|
||||
if (unlikely((loff + data_len) > virt_dev->file_size) &&
|
||||
(cmd->lba_len != 0)) {
|
||||
PRINT_INFO("Access beyond the end of the device "
|
||||
"(%lld of %lld, data len %lld)",
|
||||
(long long unsigned int)loff,
|
||||
|
||||
Reference in New Issue
Block a user