Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

[PATCH] mm/ksm.c - Fix compile warnings (PS ignore my form..

 
   Soft32 Home -> Linux -> Kernel RSS
Next:  [PATCH] mmc: fix missing module license declarati..  
Author Message
askb

External


Since: Nov 04, 2009
Posts: 3



(Msg. 1) Posted: Wed Nov 04, 2009 3:20 am
Post subject: [PATCH] mm/ksm.c - Fix compile warnings (PS ignore my formatting in previous email)
Archived from groups: linux>kernel (more info?)

Found the compiler warning on linux-next:

mm/ksm.c: In function 'ksm_scan_thread':
mm/ksm.c:1083: warning: 'page2[0u]' may be used uninitialized in this
function
mm/ksm.c:1083: note: 'page2[0u]' was declared here

fix for the above warning:

Signed-off-by: Anil SB <askb23.TakeThisOut@gmail.com>

diff --git a/mm/ksm.c b/mm/ksm.c
index bef1af4..2ea0fd3 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1080,7 +1080,7 @@ static void stable_tree_append(struct rmap_item *rmap_item,
*/
static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item)
{
- struct page *page2[1];
+ struct page *page2[1] = {NULL};
struct rmap_item *tree_rmap_item;
unsigned int checksum;
int err;




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
walter harms

External


Since: Jul 18, 2007
Posts: 9



(Msg. 2) Posted: Wed Nov 04, 2009 5:20 am
Post subject: Re: [PATCH] mm/ksm.c - Fix compile warnings (PS ignore my formatting in previous email) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

askb schrieb:
> Found the compiler warning on linux-next:
>
> mm/ksm.c: In function 'ksm_scan_thread':
> mm/ksm.c:1083: warning: 'page2[0u]' may be used uninitialized in this
> function
> mm/ksm.c:1083: note: 'page2[0u]' was declared here
>
> fix for the above warning:
>
> Signed-off-by: Anil SB <askb23.TakeThisOut@gmail.com>
>
> diff --git a/mm/ksm.c b/mm/ksm.c
> index bef1af4..2ea0fd3 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -1080,7 +1080,7 @@ static void stable_tree_append(struct rmap_item *rmap_item,
> */
> static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item)
> {
> - struct page *page2[1];
> + struct page *page2[1] = {NULL};
> struct rmap_item *tree_rmap_item;
> unsigned int checksum;
> int err;
>
>

a 1 element array looks strange, did you look what kind of magic is here used ?

re,
wh

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
askb

External


Since: Nov 04, 2009
Posts: 3



(Msg. 3) Posted: Wed Nov 04, 2009 7:20 am
Post subject: Re: [PATCH] mm/ksm.c - Fix compile warnings (PS ignore my formatting in previous email) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Wed, 2009-11-04 at 10:57 +0100, walter harms wrote:
>
> askb schrieb:
> > Found the compiler warning on linux-next:
> >
> > mm/ksm.c: In function 'ksm_scan_thread':
> > mm/ksm.c:1083: warning: 'page2[0u]' may be used uninitialized in this
> > function
> > mm/ksm.c:1083: note: 'page2[0u]' was declared here
> >
> > fix for the above warning:
> >
> > Signed-off-by: Anil SB <askb23.DeleteThis@gmail.com>
> >
> > diff --git a/mm/ksm.c b/mm/ksm.c
> > index bef1af4..2ea0fd3 100644
> > --- a/mm/ksm.c
> > +++ b/mm/ksm.c
> > @@ -1080,7 +1080,7 @@ static void stable_tree_append(struct rmap_item *rmap_item,
> > */
> > static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item)
> > {
> > - struct page *page2[1];
> > + struct page *page2[1] = {NULL};
> > struct rmap_item *tree_rmap_item;
> > unsigned int checksum;
> > int err;
> >
> >
>
> a 1 element array looks strange, did you look what kind of magic is here used ?
>
>From my understanding, it is used for place holder to check and return
an identical page from stable_tree_search(). Can we do with a double
indirection to struct page instead of the above?
PS point me in the right direction.

Regards.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
walter harms

External


Since: Jul 18, 2007
Posts: 9



(Msg. 4) Posted: Mon Nov 09, 2009 3:20 am
Post subject: Re: [PATCH] mm/ksm.c - Fix compile warnings (PS ignore my formatting in previous email) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

askb schrieb:
> On Wed, 2009-11-04 at 10:57 +0100, walter harms wrote:
>> askb schrieb:
>>> Found the compiler warning on linux-next:
>>>
>>> mm/ksm.c: In function 'ksm_scan_thread':
>>> mm/ksm.c:1083: warning: 'page2[0u]' may be used uninitialized in this
>>> function
>>> mm/ksm.c:1083: note: 'page2[0u]' was declared here
>>>
>>> fix for the above warning:
>>>
>>> Signed-off-by: Anil SB <askb23 RemoveThis @gmail.com>
>>>
>>> diff --git a/mm/ksm.c b/mm/ksm.c
>>> index bef1af4..2ea0fd3 100644
>>> --- a/mm/ksm.c
>>> +++ b/mm/ksm.c
>>> @@ -1080,7 +1080,7 @@ static void stable_tree_append(struct rmap_item *rmap_item,
>>> */
>>> static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item)
>>> {
>>> - struct page *page2[1];
>>> + struct page *page2[1] = {NULL};
>>> struct rmap_item *tree_rmap_item;
>>> unsigned int checksum;
>>> int err;
>>>
>>>
>> a 1 element array looks strange, did you look what kind of magic is here used ?
>>
>>From my understanding, it is used for place holder to check and return
> an identical page from stable_tree_search(). Can we do with a double
> indirection to struct page instead of the above?
> PS point me in the right direction.
>

1. sorry for delay.

2. there is no "right" direction. the result should be clear for the code, and this
may change between releases, special circumstances may occur and so on.

You may try something like that:

struct page *dst ;

function ( &dst );

IMHO that would clarify the code and fix the naming (page,page2 is not very descriptiv).


re,
wh

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
askb

External


Since: Nov 04, 2009
Posts: 3



(Msg. 5) Posted: Mon Nov 09, 2009 9:20 am
Post subject: Re: [PATCH] mm/ksm.c - Fix compile warnings (PS ignore my formatting in previous email) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Mon, 2009-11-09 at 10:51 +0000, Hugh Dickins wrote:
> On Wed, 4 Nov 2009, askb wrote:
> > On Wed, 2009-11-04 at 10:57 +0100, walter harms wrote:
> > >
> > > askb schrieb:
> > > > Found the compiler warning on linux-next:
> > > >
> > > > mm/ksm.c: In function 'ksm_scan_thread':
> > > > mm/ksm.c:1083: warning: 'page2[0u]' may be used uninitialized in this
> > > > function
> > > > mm/ksm.c:1083: note: 'page2[0u]' was declared here
> > > >
> > > > fix for the above warning:
> > > >
> > > > Signed-off-by: Anil SB <askb23.RemoveThis@gmail.com>
> > > >
> > > > diff --git a/mm/ksm.c b/mm/ksm.c
> > > > index bef1af4..2ea0fd3 100644
> > > > --- a/mm/ksm.c
> > > > +++ b/mm/ksm.c
> > > > @@ -1080,7 +1080,7 @@ static void stable_tree_append(struct rmap_item *rmap_item,
> > > > */
> > > > static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item)
> > > > {
> > > > - struct page *page2[1];
> > > > + struct page *page2[1] = {NULL};
> > > > struct rmap_item *tree_rmap_item;
> > > > unsigned int checksum;
> > > > int err;
> > > >
> > > >
> > >
> > > a 1 element array looks strange, did you look what kind of magic is here used ?
> > >
> > >From my understanding, it is used for place holder to check and return
> > an identical page from stable_tree_search(). Can we do with a double
> > indirection to struct page instead of the above?
> > PS point me in the right direction.
>
> I don't particularly like things like page2[1] myself, but there's
> nothing actually wrong with it, so no urgency to change it.
>
> mm/ksm.c is under active development (better Cc the people involved
> with a sourcefile when considering changes to it), and I have a
> collection of patches under testing, which do change some names
> around here (along with more serious changes). So, thanks for looking
> at this, but I'd prefer to avoid the interference of a trivial patch
> at the moment - sorry.
>
> Which version of the compiler gave you that uninitialized warning?

gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux)

> A version which lots of people are using, or just some snapshot?
> I've never seen a warning there myself, but they do keep "refining"
> that logic.
>
I got the warning while doing "make randconfig". However, now after a
cleanup and redoing the same, the warning is not seen.

> Hugh's hypothesis: for every variable x initialized by a subfunction,
> there exists at least one version V of gcc, such that V reports that
> x may be used uninitialized.
>
> Hugh

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Display posts from previous:   
Related Topics:
[PATCH 13/19] kbuild: ignore section mismatch warnings ori.. - Subject: [PATCH 13/19] kbuild: ignore section mismatch warnings originating from .note section From: Sam Ravnborg..

[PATCH] Fix compile warnings in r8169 - Fix compile warnings in r8169. It doesn't fix "real" bugs, only that the driver compiles cleanly without warn...

[PATCH 6/12] acpi: fix compile warnings - Fix compile warnings: drivers/acpi/bus.c: In function 'acpi_bus_get_power': drivers/acpi/bus.c:162: warning: implici...

[PATCH]: HVCS char driver janitoring: fix compile warnings - This is a non-urgent patch. I can't figure out who the upstream maintainer for char drivers is supposed to be. Can..

linux-2.6.21-rc2 compile warnings - Hi, As I compile the linux-2.6.21-rc2 (gcc version 3.4.6), there's some warning messages: ..

voyager_{thread,cat}.c compile warnings - Hi, I noticed this warnings on current git: .... arch/i386/mach-voyager/voyager_thread.c: In function 'thread':..
       Soft32 Home -> Linux -> Kernel All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]