More Coverity-reported issues.
Another bundle of issues from Coverity triage.
The first one is in x86/mm, and looks scarier than it is. The others are all in xen/drivers and AFAICT are pretty minor.
Cheers,
Tim.
PATCH 1/9 x86/mm: Don't dereference p2m pointer before NULL check.
Not a security bug, because in fact this is never called with a NULL argument.
Coverity CID 1055955
--- xen/arch/x86/mm/p2m.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
xen/arch/x86/mm/p2m.c +3 -1
@@ -453,7 +453,7 @@ void p2m_teardown(struct p2m_domain *p2m)* We know we don't have any extra mappings to these pages */ {struct page_info *pg; -struct domain *d = p2m->domain; +struct domain *d;unsigned long gfn;p2m_type_t t;mfn_t mfn;
@@ -461,6 +461,8 @@ void p2m_teardown(struct p2m_domain *p2m)if (p2m ==NULL )return ; + d = p2m->domain; +p2m_lock (p2m);/* Try to unshare any remaining shared p2m entries. Safeguard
Signature · 1 line
1.7.10.4
PATCH 2/9 passthrough/amd: Drop unnecessary lock lookup.
In reply to Tim DeeganThe lock's not used for anything, and AFAICT no locking is needed since the IVRS tables are static after boot.
Coverity CID 1087199
--- xen/drivers/passthrough/amd/iommu_intr.c | 1 - 1 file changed, 1 deletion(-)
xen/drivers/passthrough/amd/iommu_intr.c +0 -1
@@ -443,7 +443,6 @@ static int update_intremap_entry_from_msi_msg(* devices. */ - lock =get_intremap_lock (iommu->seg, alias_id);if ( ( req_id != alias_id ) &&get_ivrs_mappings (iommu->seg)[alias_id].intremap_table !=NULL ) {
Signature · 1 line
1.7.10.4
Re: [PATCH 2/9] passthrough/amd: Drop unnecessary lock lookup.
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
The lock's not used for anything, and AFAICT no locking is needed since the IVRS tables are static after boot.
Coverity CID 1087199
Signed-off-by Tim Deegan <[email protected]>
That was an oversight of mine I think.
Quoted 18 lines
xen/drivers/passthrough/amd/iommu_intr.c +0
-1@@ -443,7 +443,6 @@ static int update_intremap_entry_from_msi_msg(* devices. */ - lock =get_intremap_lock (iommu->seg, alias_id);if ( ( req_id != alias_id ) &&get_ivrs_mappings (iommu->seg)[alias_id].intremap_table !=NULL ) {Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH 3/9 passthrough/amd: Missing 'break'
In reply to Tim DeeganCoverity CID 1055502
--- xen/drivers/passthrough/amd/iommu_guest.c | 1 + 1 file changed, 1 insertion(+)
xen/drivers/passthrough/amd/iommu_guest.c +1 -0
@@ -728,6 +728,7 @@ static void guest_iommu_mmio_write64(struct guest_iommu *iommu,break ;case IOMMU_EVENT_LOG_BASE_LOW_OFFSET :u64_to_reg (&iommu->event_log.reg_base, val); +break ;case IOMMU_PPR_LOG_BASE_LOW_OFFSET :u64_to_reg (&iommu->ppr_log.reg_base, val);break ;
Signature · 1 line
1.7.10.4
Re: [PATCH 3/9] passthrough/amd: Missing 'break'
Quoted 14 lines · Tim Deegan
Coverity CID 1055502
Signed-off-by Tim Deegan <[email protected]>Cc Suravee Suthikulpanit <[email protected]>Cc Jacob Shin <[email protected]>--- xen/drivers/passthrough/amd/iommu_guest.c | 1 + 1 file changed, 1 insertion(+)xen/drivers/passthrough/amd/iommu_guest.c +0
-0
xen/drivers/passthrough/amd/iommu_guest.c static void guest_iommu_mmio_write64(struct guest_iommu *iommu, · line 734
Quoted 7 lines
xen/drivers/passthrough/amd/iommu_guest.c +1
-0@@ -728,6 +728,7 @@ static void guest_iommu_mmio_write64(struct guest_iommu *iommu,break ;case IOMMU_EVENT_LOG_BASE_LOW_OFFSET :u64_to_reg (&iommu->event_log.reg_base, val); +break ;case IOMMU_PPR_LOG_BASE_LOW_OFFSET :u64_to_reg (&iommu->ppr_log.reg_base, val);break ;
PATCH 4/9 passthrough/amd: Shuffle declaration.
In reply to Tim DeeganCoverity's parser chokes on seeing __section() before the type.
Coverity CID 1087190
--- xen/drivers/passthrough/amd/iommu_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/drivers/passthrough/amd/iommu_acpi.c +1 -1
@@ -633,7 +633,7 @@ static u16 __init parse_ivhd_device_extended_range(return dev_length; } -static __initdata DECLARE_BITMAP(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)); +static DECLARE_BITMAP(__initdata ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf));static void __init parse_ivrs_ioapic (char *str) {
Signature · 1 line
1.7.10.4
Re: [PATCH 4/9] passthrough/amd: Shuffle declaration.
Quoted 18 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
Coverity's parser chokes on seeing
__section()before the type.Coverity CID 1087190
Signed-off-by Tim Deegan <[email protected]>Cc Suravee Suthikulpanit <[email protected]>Cc Jacob Shin <[email protected]>--- xen/drivers/passthrough/amd/iommu_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/drivers/passthrough/amd/iommu_acpi.c +0
-0
xen/drivers/passthrough/amd/iommu_acpi.c static u16 __init parse_ivhd_device_extended_range( · line 636
Quoted 5 lines
xen/drivers/passthrough/amd/iommu_acpi.c +1
-1@@ -633,7 +633,7 @@ static u16 __init parse_ivhd_device_extended_range(return dev_length; } -static __initdata DECLARE_BITMAP(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)); +static DECLARE_BITMAP(__initdata ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf));
But putting it inside the DECLARE_BITMAP() doesn't seem that nice either. I think the second best option - if we need to play such games for Coverity in the first place - would be to put this at the end.
Jan
Re: [PATCH 4/9] passthrough/amd: Shuffle declaration.
Quoted 21 lines · Jan Beulich
Quoted 21 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
Coverity's parser chokes on seeing
__section()before the type.Coverity CID 1087190
Signed-off-by Tim Deegan <[email protected]>Cc Suravee Suthikulpanit <[email protected]>Cc Jacob Shin <[email protected]>--- xen/drivers/passthrough/amd/iommu_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/drivers/passthrough/amd/iommu_acpi.c +0
-0@@ -633,7 +633,7 @@ static u16 __init parse_ivhd_device_extended_range(return dev_length; }
Quoted 6 lines
xen/drivers/passthrough/amd/iommu_acpi.c static u16 __init parse_ivhd_device_extended_range( · line 636
Quoted 2 lines
xen/drivers/passthrough/amd/iommu_acpi.c +1
-1-static __initdata DECLARE_BITMAP(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)); +static DECLARE_BITMAP(__initdata ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf));But putting it inside the
DECLARE_BITMAP()doesn't seem that nice either. I think the second best option - if we need to play such games for Coverity in the first place -
Yes, I think the question of how much we're willing to accommodate Coverity in our source code needs to be discussed. On that subject I have an RFC patch that introduces some annotation...
Quoted 1 line
would be to put this at the end.
Yes, that sounds better. Thus?
index 89b359c..e967eba 100644
xen/drivers/passthrough/amd/iommu_acpi.c +1 -1
@@ -633,7 +633,7 @@ static u16 __init parse_ivhd_device_extended_range(return dev_length; } -static __initdata DECLARE_BITMAP(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)); +static DECLARE_BITMAP(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)) __initdata;static void __init parse_ivrs_ioapic (char *str) {
Tim.
Re: [PATCH 4/9] passthrough/amd: Shuffle declaration.
Quoted 30 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
Quoted 21 lines · Jan Beulich
Quoted 21 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
Coverity's parser chokes on seeing
__section()before the type.Coverity CID 1087190
Signed-off-by Tim Deegan <[email protected]>Cc Suravee Suthikulpanit <[email protected]>Cc Jacob Shin <[email protected]>--- xen/drivers/passthrough/amd/iommu_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/drivers/passthrough/amd/iommu_acpi.c +0
-0@@ -633,7 +633,7 @@ static u16 __init parse_ivhd_device_extended_range(return dev_length; }Quoted 6 lines
xen/drivers/passthrough/amd/iommu_acpi.c static u16 __init parse_ivhd_device_extended_range( · line 636
Quoted 2 lines
xen/drivers/passthrough/amd/iommu_acpi.c +1
-1-static __initdata DECLARE_BITMAP(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)); +static DECLARE_BITMAP(__initdata ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf));But putting it inside the
DECLARE_BITMAP()doesn't seem that nice either. I think the second best option - if we need to play such games for Coverity in the first place -
Quoted 7 lines
Yes, I think the question of how much we're willing to accommodate Coverity in our source code needs to be discussed. On that subject I have an RFC patch that introduces some annotation...
Quoted 1 line
would be to put this at the end.
Yes, that sounds better. Thus?
Ack.
Quoted 13 lines
xen/drivers/passthrough/amd/iommu_acpi.c +1
-1@@ -633,7 +633,7 @@ static u16 __init parse_ivhd_device_extended_range(return dev_length; } -static __initdata DECLARE_BITMAP(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)); +static DECLARE_BITMAP(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)) __initdata;static void __init parse_ivrs_ioapic (char *str) {Tim.
Suravee Suthikulpanit
Acked-byRe: [PATCH 4/9] passthrough/amd: Shuffle declaration.
Quoted 42 lines · Jan Beulich
Quoted 28 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
Quoted 21 lines · Jan Beulich
Quoted 21 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
Coverity's parser chokes on seeing
__section()before the type.Coverity CID 1087190
Signed-off-by Tim Deegan <[email protected]>Cc Suravee Suthikulpanit <[email protected]>Cc Jacob Shin <[email protected]>--- xen/drivers/passthrough/amd/iommu_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/drivers/passthrough/amd/iommu_acpi.c +0
-0@@ -633,7 +633,7 @@ static u16 __init parse_ivhd_device_extended_range(return dev_length; }Quoted 5 lines
xen/drivers/passthrough/amd/iommu_acpi.c static u16 __init parse_ivhd_device_extended_range( · line 636
Quoted 2 lines
xen/drivers/passthrough/amd/iommu_acpi.c +1
-1-static __initdata DECLARE_BITMAP(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)); +static DECLARE_BITMAP(__initdata ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf));But putting it inside the
DECLARE_BITMAP()doesn't seem that nice either. I think the second best option - if we need to play such games for Coverity in the first place -Quoted 6 lines
Yes, I think the question of how much we're willing to accommodate Coverity in our source code needs to be discussed. On that subject I have an RFC patch that introduces some annotation...
Quoted 1 line
would be to put this at the end.
Yes, that sounds better. Thus?
Ack.
Quoted 6 lines
xen/drivers/passthrough/amd/iommu_acpi.c +0
-0@@ -633,7 +633,7 @@ static u16 __init parse_ivhd_device_extended_range(return dev_length; }
Quoted 7 lines
Quoted 7 lines
xen/drivers/passthrough/amd/iommu_acpi.c +1
-1-static __initdata DECLARE_BITMAP(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)); +static DECLARE_BITMAP(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)) __initdata;static void __init parse_ivrs_ioapic (char *str) {Tim.
PATCH 5/9 cpufreq: avoid integer overflows.
In reply to Tim DeeganThe def_sampling_rate() one is, I think, a real bug. The others were spotted at the same time and are probably not bugs until we start dealing with 40GHz CPus.
Coverity CID 1055682
Coverity CID 1055683
--- xen/drivers/cpufreq/cpufreq_ondemand.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
xen/drivers/cpufreq/cpufreq_ondemand.c +4 -3
@@ -144,7 +144,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) }/* Check for frequency increase */ -if (max_load_freq > dbs_tuners_ins.up_threshold * policy->cur) { +if (max_load_freq > (uint64_t ) dbs_tuners_ins.up_threshold * policy->cur) {/* if we are already at full speed then break out early */ if (policy->cur == max)return ;
@@ -162,7 +162,8 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)* can support the current CPU usage without triggering the up * policy. To be safe, we focus 10 points under the threshold. */ -if (max_load_freq < (dbs_tuners_ins.up_threshold -10 ) * policy->cur) { +if (max_load_freq + < (uint64_t ) (dbs_tuners_ins.up_threshold -10 ) * policy->cur) {uint64_t freq_next; freq_next = max_load_freq / (dbs_tuners_ins.up_threshold -10 );
@@ -246,7 +247,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event)* is used for first time */ if ((dbs_enable ==1 ) && !dbs_tuners_ins.sampling_rate) { - def_sampling_rate = policy->cpuinfo.transition_latency * + def_sampling_rate = (uint64_t ) policy->cpuinfo.transition_latency *DEF_SAMPLING_RATE_LATENCY_MULTIPLIER ;if (def_sampling_rate <MIN_STAT_SAMPLING_RATE )
Signature · 1 line
1.7.10.4
Re: [PATCH 5/9] cpufreq: avoid integer overflows.
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
The
def_sampling_rate()one is, I think, a real bug. The others were spotted at the same time and are probably not bugs until we start dealing with 40GHz CPus.Coverity CID 1055682
Coverity CID 1055683Signed-off-by Tim Deegan <[email protected]>
Quoted 45 lines
Cc Liu Jinsong <[email protected]>--- xen/drivers/cpufreq/cpufreq_ondemand.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)xen/drivers/cpufreq/cpufreq_ondemand.c +1
-1@@ -144,7 +144,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) }/* Check for frequency increase */ -if (max_load_freq > dbs_tuners_ins.up_threshold * policy->cur) { +if (max_load_freq > (uint64_t ) dbs_tuners_ins.up_threshold * policy->cur) {/* if we are already at full speed then break out early */ if (policy->cur == max) return;xen/drivers/cpufreq/cpufreq_ondemand.c +2
-1@@ -162,7 +162,8 @@ static void dbs_check_cpu(struct cpu_dbs_info_s*this_dbs_info) * can support the current CPU usage without triggering the up * policy. To be safe, we focus 10 points under the threshold. */ -if (max_load_freq < (dbs_tuners_ins.up_threshold -10 ) * policy->cur) { +if (max_load_freq + < (uint64_t ) (dbs_tuners_ins.up_threshold -10 ) * policy->cur) {uint64_t freq_next;freq_next = max_load_freq / (dbs_tuners_ins.up_threshold - 10);xen/drivers/cpufreq/cpufreq_ondemand.c +1
-1@@ -246,7 +247,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,unsigned int event) * is used for first time */ if ((dbs_enable ==1 ) && !dbs_tuners_ins.sampling_rate) { - def_sampling_rate = policy->cpuinfo.transition_latency * + def_sampling_rate = (uint64_t ) policy->cpuinfo.transition_latency *DEF_SAMPLING_RATE_LATENCY_MULTIPLIER ;if (
def_sampling_rate<MIN_STAT_SAMPLING_RATE)Signature · 1 line
1.7.10.4
Re: [PATCH 5/9] cpufreq: avoid integer overflows.
In reply to Tim DeeganQuoted 48 lines · Tim Deegan
The
def_sampling_rate()one is, I think, a real bug. The others were spotted at the same time and are probably not bugs until we start dealing with 40GHz CPus.Coverity CID 1055682
Coverity CID 1055683Signed-off-by Tim Deegan <[email protected]>Cc Jan Beulich <[email protected]>Cc Liu Jinsong <[email protected]>--- xen/drivers/cpufreq/cpufreq_ondemand.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/xen/drivers/cpufreq/cpufreq_ondemand.cindex b3f9ab8..7fdba03 100644xen/drivers/cpufreq/cpufreq_ondemand.c +1
-2@@ -144,7 +144,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) }/* Check for frequency increase */ -if (max_load_freq > dbs_tuners_ins.up_threshold * policy->cur) { +if (max_load_freq > (uint64_t ) dbs_tuners_ins.up_threshold * policy->cur) {/* if we are already at full speed then break out early */ if (policy->cur == max)return ;@@ -162,7 +162,8 @@ static void dbs_check_cpu(struct cpu_dbs_info_s*this_dbs_info) * can support the current CPU usage without triggering the up * policy. To be safe, we focus 10 points under the threshold. */ - if (max_load_freq < (dbs_tuners_ins.up_threshold - 10) *
policy->cur) { + if (max_load_freq
+ < (uint64_t) (dbs_tuners_ins.up_threshold - 10) *
policy->cur) {uint64_tfreq_next;
freq_next=max_load_freq/ (dbs_tuners_ins.up_threshold -
10); @@ -246,7 +247,7 @@ intcpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event)* is used for first time */ if ((dbs_enable == 1) && !dbs_tuners_ins.sampling_rate) {xen/drivers/cpufreq/cpufreq_ondemand.c +1
-1- def_sampling_rate = policy->cpuinfo.transition_latency * + def_sampling_rate = (uint64_t ) policy->cpuinfo.transition_latency *
DEF_SAMPLING_RATE_LATENCY_MULTIPLIER;
Quoted 1 line
if (
def_sampling_rate<MIN_STAT_SAMPLING_RATE)
PATCH 6/9 cpufreq: missing check of copy_from_guest()
In reply to Tim DeeganCoverity CID 1055131
Coverity CID 1055132
--- xen/drivers/cpufreq/cpufreq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
xen/drivers/cpufreq/cpufreq.c +6 -2
@@ -471,8 +471,12 @@ int set_px_pminfo(uint32_t acpi_id, struct xen_processor_performance *dom0_px_in ret = -ENOMEM ; goto out; } -copy_from_guest (pxpt->states, dom0_px_info->states, - dom0_px_info->state_count); +if (copy_from_guest (pxpt->states, dom0_px_info->states, + dom0_px_info->state_count) ) + { + ret = -EFAULT ; + goto out; + } pxpt->state_count = dom0_px_info->state_count;if ( cpufreq_verbose )
Signature · 1 line
1.7.10.4
Re: [PATCH 6/9] cpufreq: missing check of copy_from_guest()
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
Coverity CID 1055131
Coverity CID 1055132Signed-off-by Tim Deegan <[email protected]>
Quoted 26 lines
Cc Liu Jinsong <[email protected]>--- xen/drivers/cpufreq/cpufreq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)xen/drivers/cpufreq/cpufreq.c +6
-2@@ -471,8 +471,12 @@ int set_px_pminfo(uint32_t acpi_id, struct xen_processor_performance *dom0_px_in ret = -ENOMEM ; goto out; } -copy_from_guest (pxpt->states, dom0_px_info->states, - dom0_px_info->state_count); +if (copy_from_guest (pxpt->states, dom0_px_info->states, + dom0_px_info->state_count) ) + { + ret = -EFAULT ; + goto out; + } pxpt->state_count = dom0_px_info->state_count;if ( cpufreq_verbose )Signature · 1 line
1.7.10.4
Re: [PATCH 6/9] cpufreq: missing check of copy_from_guest()
In reply to Tim DeeganQuoted 20 lines · Tim Deegan
Coverity CID 1055131
Coverity CID 1055132Signed-off-by Tim Deegan <[email protected]>Cc Jan Beulich <[email protected]>Cc Liu Jinsong <[email protected]>--- xen/drivers/cpufreq/cpufreq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)xen/drivers/cpufreq/cpufreq.c +0
-1@@ -471,8 +471,12 @@ int set_px_pminfo(uint32_t acpi_id, struct xen_processor_performance *dom0_px_in ret = -ENOMEM; goto out; } - copy_from_guest(pxpt->states, dom0_px_info->states,
xen/drivers/cpufreq/cpufreq.c int set_px_pminfo(uint32_t acpi_id, struct · line 482
Quoted 10 lines
xen/drivers/cpufreq/cpufreq.c +6
-1- dom0_px_info->state_count); +if (copy_from_guest (pxpt->states, dom0_px_info->states, + dom0_px_info->state_count) ) + { + ret = -EFAULT ; + goto out; + } pxpt->state_count = dom0_px_info->state_count;if ( cpufreq_verbose )
PATCH 7/9 ehci-dbgp: avoid division by zero.
In reply to Tim DeeganUnlikely to ever see hardware reporting 0 ports, but might as well fail gracefully if we do.
Coverity CID 1055266
--- xen/drivers/char/ehci-dbgp.c | 3 +++ 1 file changed, 3 insertions(+)
xen/drivers/char/ehci-dbgp.c +3 -0
@@ -1099,6 +1099,9 @@ try_next_port:dbgp_printk ("n_ports: %u\n" , n_ports);ehci_dbgp_status (dbgp,"" ); +if ( n_ports ==0 ) +return -1 ; +for ( i =1 ; i <= n_ports; i++ ) { portsc =readl (&dbgp->ehci_regs->port_status[i-1 ]);
Signature · 1 line
1.7.10.4
Re: [PATCH 7/9] ehci-dbgp: avoid division by zero.
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
Unlikely to ever see hardware reporting 0 ports, but might as well fail gracefully if we do.
Coverity CID 1055266
Signed-off-by Tim Deegan <[email protected]>
Well, that's a really pointless change, but anyway:
Quoted 20 lines
--- xen/drivers/char/ehci-dbgp.c | 3 +++ 1 file changed, 3 insertions(+)xen/drivers/char/ehci-dbgp.c +3
-0@@ -1099,6 +1099,9 @@ try_next_port:dbgp_printk ("n_ports: %u\n" , n_ports);ehci_dbgp_status (dbgp,"" ); +if ( n_ports ==0 ) +return -1 ; +for ( i =1 ; i <= n_ports; i++ ) { portsc =readl (&dbgp->ehci_regs->port_status[i-1 ]);Signature · 1 line
1.7.10.4
PATCH 8/9 ehci-dbgp: drop dead code.
In reply to Tim DeeganWe can only reach this spot by breaking out of the scan loop, so by construction ret > 0.
Coverity CID 1055259
--- xen/drivers/char/ehci-dbgp.c | 5 ----- 1 file changed, 5 deletions(-)
xen/drivers/char/ehci-dbgp.c +0 -5
@@ -946,11 +946,6 @@ try_again:dbgp_printk ("could not find attached debug device\n" ); goto err; } -if ( ret <0 ) - { -dbgp_printk ("attached device is not a debug device\n" ); - goto err; - } dbgp->out.endpoint = dbgp_desc.bDebugOutEndpoint; dbgp->in.endpoint = dbgp_desc.bDebugInEndpoint;
Signature · 1 line
1.7.10.4
Re: [PATCH 8/9] ehci-dbgp: drop dead code.
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
We can only reach this spot by breaking out of the scan loop, so by construction ret > 0.
Coverity CID 1055259
Signed-off-by Tim Deegan <[email protected]>
But this should really be patched in the original (Linux) first...
Quoted 22 lines
--- xen/drivers/char/ehci-dbgp.c | 5 ----- 1 file changed, 5 deletions(-)xen/drivers/char/ehci-dbgp.c +0
-5@@ -946,11 +946,6 @@ try_again:dbgp_printk ("could not find attached debug device\n" ); goto err; } -if ( ret <0 ) - { -dbgp_printk ("attached device is not a debug device\n" ); - goto err; - } dbgp->out.endpoint = dbgp_desc.bDebugOutEndpoint; dbgp->in.endpoint = dbgp_desc.bDebugInEndpoint;Signature · 1 line
1.7.10.4
PATCH 9/9 acpi/pmstat: fix check for empty name strings.
In reply to Tim DeeganThese 'name' strings are actually arrays in their structs. So the address is never NULL: instead, we should check the first character to detect cases where the field wasn't initialized.
Coverity CID 1055633
--- xen/drivers/acpi/pmstat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
xen/drivers/acpi/pmstat.c +2 -2
@@ -264,13 +264,13 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op) op->u.get_para.scaling_max_freq = policy->max; op->u.get_para.scaling_min_freq = policy->min; -if ( cpufreq_driver->name ) +if ( cpufreq_driver->name[0 ] )strlcpy (op->u.get_para.scaling_driver, cpufreq_driver->name,CPUFREQ_NAME_LEN );else strlcpy (op->u.get_para.scaling_driver,"Unknown" ,CPUFREQ_NAME_LEN ); -if ( policy->governor->name ) +if ( policy->governor->name[0 ] )strlcpy (op->u.get_para.scaling_governor, policy->governor->name,CPUFREQ_NAME_LEN );else
Signature · 1 line
1.7.10.4
Re: [PATCH 9/9] acpi/pmstat: fix check for empty name strings.
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
These 'name' strings are actually arrays in their structs. So the address is never NULL: instead, we should check the first character to detect cases where the field wasn't initialized.
Coverity CID 1055633
Signed-off-by Tim Deegan <[email protected]>
Quoted 27 lines
--- xen/drivers/acpi/pmstat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)xen/drivers/acpi/pmstat.c +2
-2@@ -264,13 +264,13 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op) op->u.get_para.scaling_max_freq = policy->max; op->u.get_para.scaling_min_freq = policy->min; -if ( cpufreq_driver->name ) +if ( cpufreq_driver->name[0 ] )strlcpy (op->u.get_para.scaling_driver, cpufreq_driver->name,CPUFREQ_NAME_LEN );else strlcpy (op->u.get_para.scaling_driver,"Unknown" ,CPUFREQ_NAME_LEN ); -if ( policy->governor->name ) +if ( policy->governor->name[0 ] )strlcpy (op->u.get_para.scaling_governor, policy->governor->name,CPUFREQ_NAME_LEN );else
Signature · 1 line
1.7.10.4
Quoted 8 lines · Tim Deegan
Another bundle of issues from Coverity triage.
The first one is in x86/mm, and looks scarier than it is. The others are all in xen/drivers and AFAICT are pretty minor.Cheers,
Tim.
All Reviewed-by: Andrew Cooper <[email protected]>
Quoted 5 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel