All of lore.kernel.org
 help / color / mirror / Atom feed
* Some code review findings for nilfs-utils
@ 2009-07-10 16:13 Eric Sandeen
       [not found] ` <4A57688C.8080308-+82itfer+wXR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2009-07-10 16:13 UTC (permalink / raw)
  To: users-JrjvKiOkagjYtjvyW6yDsg

We ran an automated code checker over nilfs-utils-2.0.13, and it found
just a few issues:

                     start < NILFS_CNO_MIN || end > NILFS_CNO_MAX) {
 /BUILD/nilfs-utils-2.0.13/bin/rmcp.c  203  Warning 685:
     Relational operator '>' always evaluates to 'false'


                         oflags |= O_RDONLY;
 /BUILD/nilfs-utils-2.0.13/lib/nilfs.c  294  Info 835: A
     zero has been given as right argument to operator '|'


 /BUILD/nilfs-utils-2.0.13/lib/nilfs.c  899  Warning 438:
     Last value assigned to variable 'n' (defined at line 895) not used


         pseg->p_maxblocks = nblocks_per_segment - blkoff;
 /BUILD/nilfs-utils-2.0.13/lib/nilfs.c  732  Info 712: Loss
     of precision (assignment) (unsigned long to unsigned int)


Sorry for not sending patches, but I assume the maintainers can do a
proper fix more quickly than I can.  :)

Thanks,

-Eric

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

* Re: Some code review findings for nilfs-utils
       [not found] ` <4A57688C.8080308-+82itfer+wXR7s880joybQ@public.gmane.org>
@ 2009-07-10 17:29   ` Ryusuke Konishi
  0 siblings, 0 replies; 2+ messages in thread
From: Ryusuke Konishi @ 2009-07-10 17:29 UTC (permalink / raw)
  To: users-JrjvKiOkagjYtjvyW6yDsg, sandeen-+82itfer+wXR7s880joybQ
  Cc: konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg

Hi,
On Fri, 10 Jul 2009 11:13:00 -0500, Eric Sandeen wrote:
> We ran an automated code checker over nilfs-utils-2.0.13, and it found
> just a few issues:
> 
>                      start < NILFS_CNO_MIN || end > NILFS_CNO_MAX) {
>  /BUILD/nilfs-utils-2.0.13/bin/rmcp.c  203  Warning 685:
>      Relational operator '>' always evaluates to 'false'
> 
> 
>                          oflags |= O_RDONLY;
>  /BUILD/nilfs-utils-2.0.13/lib/nilfs.c  294  Info 835: A
>      zero has been given as right argument to operator '|'
> 
> 
>  /BUILD/nilfs-utils-2.0.13/lib/nilfs.c  899  Warning 438:
>      Last value assigned to variable 'n' (defined at line 895) not used
> 
> 
>          pseg->p_maxblocks = nblocks_per_segment - blkoff;
>  /BUILD/nilfs-utils-2.0.13/lib/nilfs.c  732  Info 712: Loss
>      of precision (assignment) (unsigned long to unsigned int)
> 
> 
> Sorry for not sending patches, but I assume the maintainers can do a
> proper fix more quickly than I can.  :)
> 
> Thanks,
> 
> -Eric

Thanks.  I picked up the first and the third warnings and have pushed
the fixes into the git repo.  ;)

The rest were ok.  The following patch is a digest of the two.

Cheers,
Ryusuke Konishi
--
diff --git a/bin/rmcp.c b/bin/rmcp.c
index 93e0511..2d7a2b9 100644
--- a/bin/rmcp.c
+++ b/bin/rmcp.c
@@ -199,8 +199,7 @@ int main(int argc, char *argv[])
 	for ( ; optind < argc; optind++) {
 		if (nilfs_parse_cno_range(argv[optind], &start, &end,
 					  RMCP_BASE) < 0 ||
-		    start > end ||
-		    start < NILFS_CNO_MIN || end > NILFS_CNO_MAX) {
+		    start > end || start < NILFS_CNO_MIN) {
 			fprintf(stderr,
 				"%s: invalid checkpoint range: %s\n",
 				progname, argv[optind]);
diff --git a/lib/nilfs.c b/lib/nilfs.c
index df8792b..63570f4 100644
--- a/lib/nilfs.c
+++ b/lib/nilfs.c
@@ -913,9 +913,7 @@ void nilfs_block_next(struct nilfs_block *blk)
 nilfs_cno_t nilfs_get_oldest_cno(struct nilfs *nilfs)
 {
 	struct nilfs_cpinfo cpinfo[1];
-	ssize_t n;
 	
-	n = nilfs_get_cpinfo(nilfs, nilfs->n_mincno, NILFS_CHECKPOINT,
-			     cpinfo, 1);
+	nilfs_get_cpinfo(nilfs, nilfs->n_mincno, NILFS_CHECKPOINT, cpinfo, 1);
 	return nilfs->n_mincno;
 }

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

end of thread, other threads:[~2009-07-10 17:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-10 16:13 Some code review findings for nilfs-utils Eric Sandeen
     [not found] ` <4A57688C.8080308-+82itfer+wXR7s880joybQ@public.gmane.org>
2009-07-10 17:29   ` Ryusuke Konishi

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.