All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix cpufreq_update_policy
@ 2004-01-28 21:52 Dominik Brodowski
  2004-01-28 22:12 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Dominik Brodowski @ 2004-01-28 21:52 UTC (permalink / raw)
  To: davej, cpufreq


[-- Attachment #1.1: Type: text/plain, Size: 592 bytes --]

Fix a brown paper bug in drivers/cpufreq/cpufreq.c which accessed random
memory instead of the correct struct.

Please apply,

diff -ruN linux-original/drivers/cpufreq/cpufreq.c linux/drivers/cpufreq/cpufreq.c
--- linux-original/drivers/cpufreq/cpufreq.c	2004-01-16 20:30:59.000000000 +0100
+++ linux/drivers/cpufreq/cpufreq.c	2004-01-28 22:16:38.099398456 +0100
@@ -868,7 +868,7 @@
 	down(&data->lock);
 
 	memcpy(&policy, 
-	       &data, 
+	       data, 
 	       sizeof(struct cpufreq_policy));
 	policy.min = data->user_policy.min;
 	policy.max = data->user_policy.max;

[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Cpufreq mailing list
Cpufreq@www.linux.org.uk
http://www.linux.org.uk/mailman/listinfo/cpufreq

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix cpufreq_update_policy
  2004-01-28 21:52 [PATCH] fix cpufreq_update_policy Dominik Brodowski
@ 2004-01-28 22:12 ` Dmitry Torokhov
  2004-01-28 22:16   ` Dominik Brodowski
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2004-01-28 22:12 UTC (permalink / raw)
  To: Dominik Brodowski; +Cc: davej, cpufreq

On Wednesday 28 January 2004 04:52 pm, Dominik Brodowski wrote:
> Fix a brown paper bug in drivers/cpufreq/cpufreq.c which accessed
> random memory instead of the correct struct.
>
> Please apply,
>
> diff -ruN linux-original/drivers/cpufreq/cpufreq.c
> linux/drivers/cpufreq/cpufreq.c ---
> linux-original/drivers/cpufreq/cpufreq.c	2004-01-16 20:30:59.000000000
> +0100 +++ linux/drivers/cpufreq/cpufreq.c	2004-01-28 22:16:38.099398456
> +0100 @@ -868,7 +868,7 @@
>  	down(&data->lock);
>
>  	memcpy(&policy,
> -	       &data,
> +	       data,
>  	       sizeof(struct cpufreq_policy));
>  	policy.min = data->user_policy.min;
>  	policy.max = data->user_policy.max;

Why not change it to:

	policy = *data;

?

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix cpufreq_update_policy
  2004-01-28 22:12 ` Dmitry Torokhov
@ 2004-01-28 22:16   ` Dominik Brodowski
  2004-01-29  0:24     ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Dominik Brodowski @ 2004-01-28 22:16 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: davej, cpufreq


[-- Attachment #1.1: Type: text/plain, Size: 216 bytes --]

On Wed, Jan 28, 2004 at 05:12:30PM -0500, Dmitry Torokhov wrote:
> Why not change it to:
> 
> 	policy = *data;
> 
> ?

Because I doubt this works for whole structs. Or am I totally wrong (again)?

	Dominik

[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Cpufreq mailing list
Cpufreq@www.linux.org.uk
http://www.linux.org.uk/mailman/listinfo/cpufreq

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix cpufreq_update_policy
  2004-01-28 22:16   ` Dominik Brodowski
@ 2004-01-29  0:24     ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2004-01-29  0:24 UTC (permalink / raw)
  To: Dominik Brodowski; +Cc: davej, cpufreq

On Wednesday 28 January 2004 05:16 pm, Dominik Brodowski wrote:
> On Wed, Jan 28, 2004 at 05:12:30PM -0500, Dmitry Torokhov wrote:
> > Why not change it to:
> >
> > 	policy = *data;
> >
> > ?
>
> Because I doubt this works for whole structs. Or am I totally wrong
> (again)?
>
> 	Dominik

The assignment does not work only for arrays because really arrays are
constant pointers:
	char a[] == char * const a 

With structures everything is clear, size, etc. I think that K&R did not
support structure assignment but I believe that it appeared at least in
C89.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-01-29  0:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-28 21:52 [PATCH] fix cpufreq_update_policy Dominik Brodowski
2004-01-28 22:12 ` Dmitry Torokhov
2004-01-28 22:16   ` Dominik Brodowski
2004-01-29  0:24     ` Dmitry Torokhov

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.