public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jin Dongming <jin.dongming@np.css.fujitsu.com>
To: David John <davidjon@xenontk.org>
Cc: jbarnes@virtuousgeek.org, rusty@rustcorp.com.au,
	andreas.herrmann3@amd.com, rjw@sisk.pl,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] Check the node argument passed to cpumask_of_node
Date: Mon, 04 Jan 2010 14:15:30 +0900	[thread overview]
Message-ID: <4B417972.7000200@np.css.fujitsu.com> (raw)
In-Reply-To: <1262412947-3890-1-BlackWidow-davidjon@xenontk.org>

Hi, David

This problem also happened when the CONFIG_DEBUG_PER_CPU_MAPS was used,
so how about modifying the code for it working well?

Best Regards,
Jin Dongming

David John wrote:
> Commit e0cd516 "PCI: derive nearby CPUs from device's instead of bus' NUMA information"
> causes an null pointer dereference when reading from the sysfs attributes local_cpu*
> on Intel machines with no ACPI NUMA proximity info, since dev->numa_node gets set to -1
> for all PCI devices, which then gets passed to cpumask_of_node.
> 
> Ensure that the node value is valid.
> 
> Signed-off-by: David John <davidjon@xenontk.org>
> 
> diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
> index c5087d7..1141a6e 100644
> --- a/arch/x86/include/asm/topology.h
> +++ b/arch/x86/include/asm/topology.h
> @@ -99,7 +99,8 @@ extern const struct cpumask *cpumask_of_node(int node);
>  /* Returns a pointer to the cpumask of CPUs on Node 'node'. */
>  static inline const struct cpumask *cpumask_of_node(int node)
>  {
> -	return node_to_cpumask_map[node];
> +	return (node < 0 || node >= nr_node_ids) ? cpu_online_mask :
> +						   node_to_cpumask_map[node];
>  }
>  #endif
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 



  parent reply	other threads:[~2010-01-04  5:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-01 19:50 [Regression] 2.6.33-rc2 - pci: Commit e0cd516 causes OOPS David John
2010-01-01 19:55 ` [PATCH] Check the node argument passed to cpumask_of_node David John
2010-01-01 21:55 ` [Regression] 2.6.33-rc2 - pci: Commit e0cd516 causes OOPS Rafael J. Wysocki
2010-01-02  6:15   ` [PATCH v2] Check the node argument passed to cpumask_of_node David John
2010-01-04  4:28     ` Rusty Russell
2010-01-04 11:42       ` David John
2010-01-04 14:58         ` [PATCH v3] " David John
2010-01-04 17:18           ` Jesse Barnes
2010-01-04  5:15     ` Jin Dongming [this message]
2010-01-01 22:22 ` [Regression] 2.6.33-rc2 - pci: Commit e0cd516 causes OOPS Yinghai Lu
2010-01-02  6:18   ` David John

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=4B417972.7000200@np.css.fujitsu.com \
    --to=jin.dongming@np.css.fujitsu.com \
    --cc=andreas.herrmann3@amd.com \
    --cc=davidjon@xenontk.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=rusty@rustcorp.com.au \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox