 3d4a8bf0ee
			
		
	
	
		3d4a8bf0ee
		
	
	
	
	
		
			
			Emulation of the block limits VPD page called back into scsi-disk.c, which however expected the request to be for a SCSIDiskState and accessed a scsi-generic device outside the bounds of its struct (namely to retrieve s->max_unmap_size and s->max_io_size). To avoid this, move the emulation code to a separate function that takes a new SCSIBlockLimits struct and marshals it into the VPD response format. Reported-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
		
			
				
	
	
		
			17 lines
		
	
	
		
			381 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			381 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #ifndef HW_SCSI_EMULATION_H
 | |
| #define HW_SCSI_EMULATION_H 1
 | |
| 
 | |
| typedef struct SCSIBlockLimits {
 | |
|     bool wsnz;
 | |
|     uint16_t min_io_size;
 | |
|     uint32_t max_unmap_descr;
 | |
|     uint32_t opt_io_size;
 | |
|     uint32_t max_unmap_sectors;
 | |
|     uint32_t unmap_sectors;
 | |
|     uint32_t max_io_sectors;
 | |
| } SCSIBlockLimits;
 | |
| 
 | |
| int scsi_emulate_block_limits(uint8_t *outbuf, const SCSIBlockLimits *bl);
 | |
| 
 | |
| #endif
 |