notify_inotify: fix small typo in inotify_map_mask_to_filter

Christof Schmitt cs at samba.org
Thu Apr 27 23:00:14 UTC 2017


On Thu, Apr 27, 2017 at 03:43:33PM -0700, Jeremy Allison via samba-technical wrote:
> On Thu, Apr 27, 2017 at 01:19:20PM -0400, Doug Nazar via samba-technical wrote:
> > While mapping back to the filter in inotify_map_mask_to_filter() the
> > check hard codes the index as 0 so it will fail for any but the
> > first filter.
> > 
> > Tested against 4.5.8 but looks like the code is the same in HEAD.
> > 
> > Doug
> > 
> 
> > diff -ur samba-4.5.8.orig/source3/smbd/notify_inotify.c samba-4.5.8/source3/smbd/notify_inotify.c
> > --- samba-4.5.8.orig/source3/smbd/notify_inotify.c	2016-08-11 03:51:04.000000000 -0400
> > +++ samba-4.5.8/source3/smbd/notify_inotify.c	2017-04-25 18:00:43.881718699 -0400
> > @@ -97,7 +97,7 @@
> >  	uint32_t filter = 0;
> >  
> >  	for (i = 0; i < ARRAY_SIZE(inotify_mapping); i++) {
> > -		if (inotify_mapping[0].inotify_mask & mask) {
> > +		if (inotify_mapping[i].inotify_mask & mask) {
> >  			filter |= inotify_mapping[i].notify_mask;
> >  		}
> >  	}
> 
> Doug, here's the same but as a git-format patch with your
> authorship attached. Are you OK with this ?
> 
> If so, can I get a second Team reviewer ?

Obvious typo...

Reviewed-by: Christof Schmitt <cs at samba.org>

> 
> Cheers,
> 
> 	Jeremy.

> From 06a376a70c91ad4ae141cf02401defdb8d4ec09e Mon Sep 17 00:00:00 2001
> From: Doug Nazar <nazard at nazar.ca>
> Date: Thu, 27 Apr 2017 15:41:24 -0700
> Subject: [PATCH] s3: smbd: inotify_map_mask_to_filter incorrectly indexes an
>  array.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=12760
> 
> Signed-off-by: Doug Nazar <nazard at nazar.ca>
> Reviewed-by: Jeremy Allison <jra at samba.org>
> ---
>  source3/smbd/notify_inotify.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c
> index 3848dd67056..74855a9f6f9 100644
> --- a/source3/smbd/notify_inotify.c
> +++ b/source3/smbd/notify_inotify.c
> @@ -97,7 +97,7 @@ static uint32_t inotify_map_mask_to_filter(uint32_t mask)
>  	uint32_t filter = 0;
>  
>  	for (i = 0; i < ARRAY_SIZE(inotify_mapping); i++) {
> -		if (inotify_mapping[0].inotify_mask & mask) {
> +		if (inotify_mapping[i].inotify_mask & mask) {
>  			filter |= inotify_mapping[i].notify_mask;
>  		}
>  	}
> -- 
> 2.13.0.rc0.306.g87b477812d-goog
> 




More information about the samba-technical mailing list