* [PATCH 0/2] fs-ext4: Adjustments for two function implementations @ 2017-08-19 11:46 SF Markus Elfring 2017-08-19 11:47 ` [PATCH 1/2] ext4: Delete an error message for a failed memory allocation in ext4_multi_mount_protect() SF Markus Elfring 2017-08-19 11:48 ` [PATCH 2/2] ext4: Improve a size determination in two functions SF Markus Elfring 0 siblings, 2 replies; 9+ messages in thread From: SF Markus Elfring @ 2017-08-19 11:46 UTC (permalink / raw) To: linux-ext4, Andreas Dilger, Theodore Ts'o; +Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 19 Aug 2017 13:35:43 +0200 Two update suggestions were taken into account from static source code analysis. Markus Elfring (2): Delete an error message for a failed memory allocation in ext4_multi_mount_protect() Improve a size determination in two functions fs/ext4/dir.c | 2 +- fs/ext4/mmp.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) -- 2.14.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ext4: Delete an error message for a failed memory allocation in ext4_multi_mount_protect() 2017-08-19 11:46 [PATCH 0/2] fs-ext4: Adjustments for two function implementations SF Markus Elfring @ 2017-08-19 11:47 ` SF Markus Elfring 2017-08-19 17:08 ` Eric Sandeen 2017-08-19 11:48 ` [PATCH 2/2] ext4: Improve a size determination in two functions SF Markus Elfring 1 sibling, 1 reply; 9+ messages in thread From: SF Markus Elfring @ 2017-08-19 11:47 UTC (permalink / raw) To: linux-ext4, Andreas Dilger, Theodore Ts'o; +Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 19 Aug 2017 13:04:50 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- fs/ext4/mmp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c index eb9835638680..1ce00453f612 100644 --- a/fs/ext4/mmp.c +++ b/fs/ext4/mmp.c @@ -371,7 +371,6 @@ int ext4_multi_mount_protect(struct super_block *sb, - if (!mmpd_data) { - ext4_warning(sb, "not enough memory for mmpd_data"); + if (!mmpd_data) goto failed; - } + mmpd_data->sb = sb; mmpd_data->bh = bh; -- 2.14.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ext4: Delete an error message for a failed memory allocation in ext4_multi_mount_protect() 2017-08-19 11:47 ` [PATCH 1/2] ext4: Delete an error message for a failed memory allocation in ext4_multi_mount_protect() SF Markus Elfring @ 2017-08-19 17:08 ` Eric Sandeen 2017-08-19 18:00 ` SF Markus Elfring 2017-08-24 19:16 ` [PATCH 1/2] " Dan Carpenter 0 siblings, 2 replies; 9+ messages in thread From: Eric Sandeen @ 2017-08-19 17:08 UTC (permalink / raw) To: SF Markus Elfring, linux-ext4, Andreas Dilger, Theodore Ts'o Cc: LKML, kernel-janitors On 8/19/17 6:47 AM, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sat, 19 Aug 2017 13:04:50 +0200 > > Omit an extra message for a memory allocation failure in this function. I might be dense, but what makes this message "extra?" (I suppose kmalloc squawks too if it fails, but is Coccinelle now warning about explicit memory allocation failure warnings?) -Eric > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > fs/ext4/mmp.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c > index eb9835638680..1ce00453f612 100644 > --- a/fs/ext4/mmp.c > +++ b/fs/ext4/mmp.c > @@ -371,7 +371,6 @@ int ext4_multi_mount_protect(struct super_block *sb, > - if (!mmpd_data) { > - ext4_warning(sb, "not enough memory for mmpd_data"); > + if (!mmpd_data) > goto failed; > - } > + > mmpd_data->sb = sb; > mmpd_data->bh = bh; > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ext4: Delete an error message for a failed memory allocation in ext4_multi_mount_protect() 2017-08-19 17:08 ` Eric Sandeen @ 2017-08-19 18:00 ` SF Markus Elfring 2017-08-24 17:44 ` Theodore Ts'o 2017-08-24 19:16 ` [PATCH 1/2] " Dan Carpenter 1 sibling, 1 reply; 9+ messages in thread From: SF Markus Elfring @ 2017-08-19 18:00 UTC (permalink / raw) To: Eric Sandeen, linux-ext4 Cc: Andreas Dilger, Theodore Ts'o, LKML, kernel-janitors >> Omit an extra message for a memory allocation failure in this function. > > I might be dense, but what makes this message "extra?" > > (I suppose kmalloc squawks too if it fails, Do you find the default allocation failure report sufficient? > but is Coccinelle now warning about explicit memory allocation failure warnings?) This software tool can help to find source code places for further development considerations. Would you like to clarify a corresponding search pattern a bit more? Regards, Markus ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ext4: Delete an error message for a failed memory allocation in ext4_multi_mount_protect() 2017-08-19 18:00 ` SF Markus Elfring @ 2017-08-24 17:44 ` Theodore Ts'o 0 siblings, 0 replies; 9+ messages in thread From: Theodore Ts'o @ 2017-08-24 17:44 UTC (permalink / raw) To: SF Markus Elfring Cc: Eric Sandeen, linux-ext4, Andreas Dilger, LKML, kernel-janitors On Sat, Aug 19, 2017 at 08:00:31PM +0200, SF Markus Elfring wrote: > >> Omit an extra message for a memory allocation failure in this function. > > > > I might be dense, but what makes this message "extra?" > > > > (I suppose kmalloc squawks too if it fails, > > Do you find the default allocation failure report sufficient? >From a helpdesk reporting situation, having a more specific message when there is a MMP failure causing the mount to fail is definitely useful. So, NACK. - Ted ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ext4: Delete an error message for a failed memory allocation in ext4_multi_mount_protect() 2017-08-19 17:08 ` Eric Sandeen 2017-08-19 18:00 ` SF Markus Elfring @ 2017-08-24 19:16 ` Dan Carpenter 1 sibling, 0 replies; 9+ messages in thread From: Dan Carpenter @ 2017-08-24 19:16 UTC (permalink / raw) To: sandeen Cc: SF Markus Elfring, linux-ext4, Andreas Dilger, Theodore Ts'o, LKML, kernel-janitors On Sat, Aug 19, 2017 at 12:08:29PM -0500, Eric Sandeen wrote: > On 8/19/17 6:47 AM, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > > Date: Sat, 19 Aug 2017 13:04:50 +0200 > > > > Omit an extra message for a memory allocation failure in this function. > > I might be dense, but what makes this message "extra?" > > (I suppose kmalloc squawks too if it fails, but is Coccinelle > now warning about explicit memory allocation failure warnings?) > Yeah... Checkpatch complains that the kmalloc squawks is enough. "WARNING: Possible unnecessary 'out of memory' message". This allocation is small so it's guaranteed to succeed in current kernels. regards, dan carpenter ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] ext4: Improve a size determination in two functions 2017-08-19 11:46 [PATCH 0/2] fs-ext4: Adjustments for two function implementations SF Markus Elfring 2017-08-19 11:47 ` [PATCH 1/2] ext4: Delete an error message for a failed memory allocation in ext4_multi_mount_protect() SF Markus Elfring @ 2017-08-19 11:48 ` SF Markus Elfring 2017-08-20 1:49 ` Eric Sandeen 1 sibling, 1 reply; 9+ messages in thread From: SF Markus Elfring @ 2017-08-19 11:48 UTC (permalink / raw) To: linux-ext4, Andreas Dilger, Theodore Ts'o; +Cc: LKML, kernel-janitors From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 19 Aug 2017 13:14:26 +0200 Replace the specification of data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- fs/ext4/dir.c | 2 +- fs/ext4/mmp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index e8b365000d73..b04e882179c6 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -411,7 +411,7 @@ static struct dir_private_info *ext4_htree_create_dir_info(struct file *filp, { struct dir_private_info *p; - p = kzalloc(sizeof(struct dir_private_info), GFP_KERNEL); + p = kzalloc(sizeof(*p), GFP_KERNEL); if (!p) return NULL; p->curr_hash = pos2maj_hash(filp, pos); diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c index 1ce00453f612..3fa5df9f5573 100644 --- a/fs/ext4/mmp.c +++ b/fs/ext4/mmp.c @@ -367,5 +367,5 @@ int ext4_multi_mount_protect(struct super_block *sb, goto failed; } - mmpd_data = kmalloc(sizeof(struct mmpd_data), GFP_KERNEL); + mmpd_data = kmalloc(sizeof(*mmpd_data), GFP_KERNEL); if (!mmpd_data) -- 2.14.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] ext4: Improve a size determination in two functions 2017-08-19 11:48 ` [PATCH 2/2] ext4: Improve a size determination in two functions SF Markus Elfring @ 2017-08-20 1:49 ` Eric Sandeen 2017-08-24 17:50 ` Theodore Ts'o 0 siblings, 1 reply; 9+ messages in thread From: Eric Sandeen @ 2017-08-20 1:49 UTC (permalink / raw) To: SF Markus Elfring, linux-ext4, Andreas Dilger, Theodore Ts'o Cc: LKML, kernel-janitors On 8/19/17 6:48 AM, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sat, 19 Aug 2017 13:14:26 +0200 > > Replace the specification of data structures by pointer dereferences > as the parameter for the operator "sizeof" to make the corresponding size > determination a bit safer according to the Linux coding style convention. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Looks good, Reviewed-by: Eric Sandeen <sandeen@redhat.com> > --- > fs/ext4/dir.c | 2 +- > fs/ext4/mmp.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c > index e8b365000d73..b04e882179c6 100644 > --- a/fs/ext4/dir.c > +++ b/fs/ext4/dir.c > @@ -411,7 +411,7 @@ static struct dir_private_info *ext4_htree_create_dir_info(struct file *filp, > { > struct dir_private_info *p; > > - p = kzalloc(sizeof(struct dir_private_info), GFP_KERNEL); > + p = kzalloc(sizeof(*p), GFP_KERNEL); > if (!p) > return NULL; > p->curr_hash = pos2maj_hash(filp, pos); > diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c > index 1ce00453f612..3fa5df9f5573 100644 > --- a/fs/ext4/mmp.c > +++ b/fs/ext4/mmp.c > @@ -367,5 +367,5 @@ int ext4_multi_mount_protect(struct super_block *sb, > goto failed; > } > > - mmpd_data = kmalloc(sizeof(struct mmpd_data), GFP_KERNEL); > + mmpd_data = kmalloc(sizeof(*mmpd_data), GFP_KERNEL); > if (!mmpd_data) > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] ext4: Improve a size determination in two functions 2017-08-20 1:49 ` Eric Sandeen @ 2017-08-24 17:50 ` Theodore Ts'o 0 siblings, 0 replies; 9+ messages in thread From: Theodore Ts'o @ 2017-08-24 17:50 UTC (permalink / raw) To: sandeen Cc: SF Markus Elfring, linux-ext4, Andreas Dilger, LKML, kernel-janitors On Sat, Aug 19, 2017 at 08:49:20PM -0500, Eric Sandeen wrote: > On 8/19/17 6:48 AM, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > > Date: Sat, 19 Aug 2017 13:14:26 +0200 > > > > Replace the specification of data structures by pointer dereferences > > as the parameter for the operator "sizeof" to make the corresponding size > > determination a bit safer according to the Linux coding style convention. > > > > This issue was detected by using the Coccinelle software. > > > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > > Looks good, > > Reviewed-by: Eric Sandeen <sandeen@redhat.com> Thanks, applied. - Ted ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-08-24 19:16 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-08-19 11:46 [PATCH 0/2] fs-ext4: Adjustments for two function implementations SF Markus Elfring 2017-08-19 11:47 ` [PATCH 1/2] ext4: Delete an error message for a failed memory allocation in ext4_multi_mount_protect() SF Markus Elfring 2017-08-19 17:08 ` Eric Sandeen 2017-08-19 18:00 ` SF Markus Elfring 2017-08-24 17:44 ` Theodore Ts'o 2017-08-24 19:16 ` [PATCH 1/2] " Dan Carpenter 2017-08-19 11:48 ` [PATCH 2/2] ext4: Improve a size determination in two functions SF Markus Elfring 2017-08-20 1:49 ` Eric Sandeen 2017-08-24 17:50 ` Theodore Ts'o
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).