// we are in CHS mode....
*lba =
- (drive->cylinder * drive->num_heads +
+ ((uint64_t)drive->cylinder * drive->num_heads +
channel->drive_head.head_num) * drive->num_sectors +
// sector number is 1 based
(drive->sector_num - 1);
PrintDebug(VM_NONE, VCORE_NONE, "cursor_update(%d, %d, %p)\n", x, y, private_data);
/* avoid out-of-range coordinates */
- if (x < 0) x = 0;
- if (y < 0) y = 0;
if (x >= state->cols) x = state->cols - 1;
if (y >= state->rows) y = state->rows - 1;
offset = (x + y * state->cols) * BYTES_PER_COL;
if (q->cur_avail_idx != q->avail->index){
uint16_t buf_idx;
struct vring_desc * buf_desc;
- uint32_t hdr_len, len;
+ uint32_t hdr_len;
+ int len;
uint32_t offset = 0;
hdr_len = (virtio->mergeable_rx_bufs)?
target_size = state->mem_size;
break;
case GCONS_DIRECT:
- target_size = state->target_spec.height*state->target_spec.width*state->target_spec.bytes_per_pixel;
+ target_size = (uint64_t)state->target_spec.height*state->target_spec.width*state->target_spec.bytes_per_pixel;
break;
default:
PrintError(state->vm, VCORE_NONE, "paragraph: Unknown mode\n");
PrintDebug(state->vm, VCORE_NONE, "paragraph: render callback GCONS_MEM\n");
void *fb = v3_graphics_console_get_frame_buffer_data_rw(state->host_cons,&(state->target_spec));
- uint64_t target_size = state->target_spec.height*state->target_spec.width*state->target_spec.bytes_per_pixel;
+ uint64_t target_size = (uint64_t)state->target_spec.height*state->target_spec.width*state->target_spec.bytes_per_pixel;
// must be smaller than the memory we have allocated
target_size = target_size<state->mem_size ? target_size : state->mem_size;
struct blk_state * blk = NULL;
v3_cfg_tree_t * frontend_cfg = v3_cfg_subtree(cfg, "frontend");
char * dev_id = v3_cfg_val(cfg, "ID");
- uint64_t capacity = atoi(v3_cfg_val(cfg, "size")) * 1024 * 1024;
+ uint64_t capacity = atoi(v3_cfg_val(cfg, "size")) * 1024ULL * 1024ULL;
if (!frontend_cfg) {
PrintError(vm, VCORE_NONE, "Frontend Configuration not present\n");
if (specified_cpu != NULL) {
core_idx = atoi(specified_cpu);
+ // unsigned comparison with 0
if (core_idx < 0) {
PrintError(vm, VCORE_NONE, "Target CPU out of bounds (%d) \n", core_idx);
}
int v3_is_hvm_ros_mem_gpa(struct v3_vm_info *vm, addr_t gpa)
{
if (vm->hvm_state.is_hvm) {
- return gpa>=0 && gpa<vm->hvm_state.first_hrt_gpa;
+ return gpa<vm->hvm_state.first_hrt_gpa;
} else {
return 1;
}
(time_state->clock_ratio_num != 1) ||
(info->vm_info->time_state.td_num != 1) ||
(info->vm_info->time_state.td_denom != 1)) {
- if (time_state->flags | VM_TIME_TSC_PASSTHROUGH) {
+ if (time_state->flags & VM_TIME_TSC_PASSTHROUGH) {
PrintError(info->vm_info, info, "WARNING: Cannot use reqested passthrough TSC with clock or time modification also requested.\n");
time_state->flags &= ~VM_TIME_TSC_PASSTHROUGH;
}
static int get_bitmap_index(uint_t msr)
{
+ // unsigned comparison with 0 here for clarity
if( (msr >= LOW_MSR_START) && msr <= LOW_MSR_END) {
return LOW_MSR_INDEX + msr;
} else if (( msr >= HIGH_MSR_START ) && (msr <= HIGH_MSR_END)) {