From: Vadim Rozenfeld <vrozenfe@redhat.com>
To: kvm@vger.kernel.org
Subject: [PATCH] viostor driver. fix PREfast warnings.
Date: Thu, 29 Oct 2009 10:41:21 +0200 [thread overview]
Message-ID: <4AE95531.1060102@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2841 bytes --]
repository: /home/vadimr/shares/kvm-guest-drivers-windows
branch: XP
commit bf13fc498a576236cff8cbc707a4e5a1e70e22fb
Author: Vadim Rozenfeld<vrozenfe@redhat.com>
Date: Thu Oct 29 10:37:41 2009 +0200
[PATCH] viostor driver. fix PREfast warnings.
Signed-off-by: Vadim Rozenfeld<vrozenfe@redhat.com>
diff --git a/viostor/virtio_pci.c b/viostor/virtio_pci.c
index a72b019..78a6d29 100644
--- a/viostor/virtio_pci.c
+++ b/viostor/virtio_pci.c
@@ -183,6 +183,10 @@ VirtIODeviceFindVirtualQueue(
// activate the queue
pa = ScsiPortGetPhysicalAddress(DeviceExtension, NULL, info->queue,&dummy);
+ if(!pa.QuadPart) {
+ ScsiPortWritePortUlong((PULONG)(adaptExt->device_base + VIRTIO_PCI_QUEUE_PFN),(ULONG)0);
+ return NULL;
+ }
pageNum = (ULONG)(pa.QuadPart>> PAGE_SHIFT);
RhelDbgPrint(TRACE_LEVEL_FATAL, ("[%s] queue phys.address %08lx:%08lx, pfn %lx\n", __FUNCTION__, pa.u.HighPart, pa.u.LowPart, pageNum));
ScsiPortWritePortUlong((PULONG)(adaptExt->device_base + VIRTIO_PCI_QUEUE_PFN),(ULONG)(pageNum));
diff --git a/viostor/virtio_stor.c b/viostor/virtio_stor.c
index 8b91e62..c36b85b 100644
--- a/viostor/virtio_stor.c
+++ b/viostor/virtio_stor.c
@@ -247,29 +247,6 @@ VirtIoFindAdapter(
return SP_RETURN_NOT_FOUND;
}
- if (!ScsiPortValidateRange(DeviceExtension,
- ConfigInfo->AdapterInterfaceType,
- ConfigInfo->SystemIoBusNumber,
- accessRange->RangeStart,
- accessRange->RangeLength,
- (BOOLEAN)!accessRange->RangeInMemory)) {
-
- ScsiPortLogError(DeviceExtension,
- NULL,
- 0,
- 0,
- 0,
- SP_INTERNAL_ADAPTER_ERROR,
- __LINE__);
-
- RhelDbgPrint(TRACE_LEVEL_FATAL, ("Range validation failed %x for %x bytes\n",
- (*ConfigInfo->AccessRanges)[0].RangeStart.LowPart,
- (*ConfigInfo->AccessRanges)[0].RangeLength));
-
- return SP_RETURN_ERROR;
- }
-
-
ConfigInfo->NumberOfBuses = 1;
ConfigInfo->MaximumNumberOfTargets = 1;
ConfigInfo->MaximumNumberOfLogicalUnits = 1;
@@ -707,7 +684,7 @@ VirtIoAdapterControl(
RhelDbgPrint(TRACE_LEVEL_VERBOSE, ("ScsiRestartAdapter\n"));
adaptExt->pci_vq_info.vq = NULL;
#ifdef MSI_SUPPORTED
- if(!adaptExt->dump_mode& adaptExt->msix_vectors) {
+ if(!adaptExt->dump_mode&& adaptExt->msix_vectors) {
adaptExt->pci_vq_info.vq = VirtIODeviceFindVirtualQueue(DeviceExtension, 0, adaptExt->msix_vectors);
}
#endif
[-- Attachment #2: fix_prefast_warnings.patch --]
[-- Type: text/plain, Size: 2513 bytes --]
diff --git a/viostor/virtio_pci.c b/viostor/virtio_pci.c
index a72b019..78a6d29 100644
--- a/viostor/virtio_pci.c
+++ b/viostor/virtio_pci.c
@@ -183,6 +183,10 @@ VirtIODeviceFindVirtualQueue(
// activate the queue
pa = ScsiPortGetPhysicalAddress(DeviceExtension, NULL, info->queue, &dummy);
+ if(!pa.QuadPart) {
+ ScsiPortWritePortUlong((PULONG)(adaptExt->device_base + VIRTIO_PCI_QUEUE_PFN),(ULONG)0);
+ return NULL;
+ }
pageNum = (ULONG)(pa.QuadPart >> PAGE_SHIFT);
RhelDbgPrint(TRACE_LEVEL_FATAL, ("[%s] queue phys.address %08lx:%08lx, pfn %lx\n", __FUNCTION__, pa.u.HighPart, pa.u.LowPart, pageNum));
ScsiPortWritePortUlong((PULONG)(adaptExt->device_base + VIRTIO_PCI_QUEUE_PFN),(ULONG)(pageNum));
diff --git a/viostor/virtio_stor.c b/viostor/virtio_stor.c
index 8b91e62..c36b85b 100644
--- a/viostor/virtio_stor.c
+++ b/viostor/virtio_stor.c
@@ -247,29 +247,6 @@ VirtIoFindAdapter(
return SP_RETURN_NOT_FOUND;
}
- if (!ScsiPortValidateRange(DeviceExtension,
- ConfigInfo->AdapterInterfaceType,
- ConfigInfo->SystemIoBusNumber,
- accessRange->RangeStart,
- accessRange->RangeLength,
- (BOOLEAN)!accessRange->RangeInMemory)) {
-
- ScsiPortLogError(DeviceExtension,
- NULL,
- 0,
- 0,
- 0,
- SP_INTERNAL_ADAPTER_ERROR,
- __LINE__);
-
- RhelDbgPrint(TRACE_LEVEL_FATAL, ("Range validation failed %x for %x bytes\n",
- (*ConfigInfo->AccessRanges)[0].RangeStart.LowPart,
- (*ConfigInfo->AccessRanges)[0].RangeLength));
-
- return SP_RETURN_ERROR;
- }
-
-
ConfigInfo->NumberOfBuses = 1;
ConfigInfo->MaximumNumberOfTargets = 1;
ConfigInfo->MaximumNumberOfLogicalUnits = 1;
@@ -707,7 +684,7 @@ VirtIoAdapterControl(
RhelDbgPrint(TRACE_LEVEL_VERBOSE, ("ScsiRestartAdapter\n"));
adaptExt->pci_vq_info.vq = NULL;
#ifdef MSI_SUPPORTED
- if(!adaptExt->dump_mode & adaptExt->msix_vectors) {
+ if(!adaptExt->dump_mode && adaptExt->msix_vectors) {
adaptExt->pci_vq_info.vq = VirtIODeviceFindVirtualQueue(DeviceExtension, 0, adaptExt->msix_vectors);
}
#endif
reply other threads:[~2009-10-29 8:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AE95531.1060102@redhat.com \
--to=vrozenfe@redhat.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.