X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fide.c;h=e9a90a84342d83f286c86c9fa2efb6da31f047d3;hp=bc42ea8e82841a04dc9f3f613e9fe05200358098;hb=d775bbfa668ce9968bacc0e4257cf86e5ab88e90;hpb=d22c11cec4e8c3390bfe6bf16ed07f5d073f0d4a diff --git a/palacios/src/devices/ide.c b/palacios/src/devices/ide.c index bc42ea8..e9a90a8 100644 --- a/palacios/src/devices/ide.c +++ b/palacios/src/devices/ide.c @@ -299,7 +299,12 @@ static inline int get_channel_index(ushort_t port) { static inline struct ide_channel * get_selected_channel(struct ide_internal * ide, ushort_t port) { int channel_idx = get_channel_index(port); - return &(ide->channels[channel_idx]); + if (channel_idx >= 0) { + return &(ide->channels[channel_idx]); + } else { + PrintError(VM_NONE,VCORE_NONE,"ide: Cannot Determine Selected Channel\n"); + return 0; + } } static inline struct ide_drive * get_selected_drive(struct ide_channel * channel) {