kernel: Specify buffer size in certain ioctl calls.
In cases where scsi_periph checks the size of the buffer supplied to an
ioctl call (functionality added in commit ff4af513e1
) this information
needs to be provided by the caller to avoid failure.
Fixes #15094.
Change-Id: I37f2776edbe977e9825ec1837fb763a3b2aa7220
Reviewed-on: https://review.haiku-os.org/c/1584
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
f4e3bb1cc6
commit
9b72c3a089
@ -559,7 +559,7 @@ read_table_of_contents(int fd, uint32 track, uint8 format, uint8 *buffer,
|
||||
raw.sense_data = senseData;
|
||||
raw.sense_data_length = sizeof(kSenseSize);
|
||||
|
||||
if (ioctl(fd, B_RAW_DEVICE_COMMAND, &raw) == 0
|
||||
if (ioctl(fd, B_RAW_DEVICE_COMMAND, &raw, sizeof(raw)) == 0
|
||||
&& raw.scsi_status == 0 && raw.cam_status == 1) {
|
||||
free(senseData);
|
||||
return B_OK;
|
||||
|
@ -277,7 +277,8 @@ read_table_of_contents(int deviceFD, uint32 first_session, uchar* buffer,
|
||||
memset(raw_command.sense_data, 0, raw_command.sense_data_length);
|
||||
raw_command.timeout = kScsiTimeout;
|
||||
|
||||
if (ioctl(deviceFD, B_RAW_DEVICE_COMMAND, &raw_command) == 0) {
|
||||
if (ioctl(deviceFD, B_RAW_DEVICE_COMMAND, &raw_command,
|
||||
sizeof(raw_command)) == 0) {
|
||||
if (raw_command.scsi_status == 0 && raw_command.cam_status == 1) {
|
||||
// SUCCESS!!!
|
||||
DBG(dump_full_table_of_contents(buffer, buffer_length));
|
||||
|
@ -48,7 +48,7 @@ identify_partition(int fd, partition_data *partition, void **cookie)
|
||||
float result = -1;
|
||||
if ((partition->flags & B_PARTITION_IS_DEVICE) != 0
|
||||
&& partition->block_size == 2048
|
||||
&& ioctl(fd, B_GET_GEOMETRY, &geometry) == 0
|
||||
&& ioctl(fd, B_GET_GEOMETRY, &geometry, sizeof(geometry)) == 0
|
||||
&& geometry.device_type == B_CD) {
|
||||
Disc *disc = new(std::nothrow) Disc(fd);
|
||||
if (disc != NULL && disc->InitCheck() == B_OK) {
|
||||
|
@ -358,7 +358,7 @@ status_t
|
||||
KDiskDevice::GetMediaStatus(status_t* mediaStatus)
|
||||
{
|
||||
status_t error = B_OK;
|
||||
if (ioctl(fFD, B_GET_MEDIA_STATUS, mediaStatus) != 0)
|
||||
if (ioctl(fFD, B_GET_MEDIA_STATUS, mediaStatus, sizeof(*mediaStatus)) != 0)
|
||||
error = errno;
|
||||
// maybe the device driver doesn't implement this ioctl -- see, if getting
|
||||
// the device geometry succeeds
|
||||
@ -380,7 +380,7 @@ KDiskDevice::GetMediaStatus(status_t* mediaStatus)
|
||||
status_t
|
||||
KDiskDevice::GetGeometry(device_geometry* geometry)
|
||||
{
|
||||
if (ioctl(fFD, B_GET_GEOMETRY, geometry) != 0)
|
||||
if (ioctl(fFD, B_GET_GEOMETRY, geometry, sizeof(*geometry)) != 0)
|
||||
return errno;
|
||||
return B_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user