Subject: Re: [vserver] Kernel compile warnings
From: Ghislain Adnet <gadnet@aqueos.com>
Date: Fri, 29 Dec 2017 09:06:08 +0100

Hi,

Will this patch :



-------------------------------------------------------

--- /vservers/kernel/linux-4.1.46/kernel/vserver/proc.c 2017-11-15 13:58:57.568589199
+0100
+++ /vservers/kernel/linux-4.1.48/kernel/vserver/proc.c 2017-12-28 18:36:05.386565789
+0100
@@ -617,13 +617,13 @@
        switch (ctx->pos) {
        case 0:
                ino = inode->i_ino;
-               if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
+               if ( dir_emit(ctx, ".", 1, ino, DT_DIR) )
                        goto out;
                ctx->pos++;
                /* fall through */
        case 1:
                ino = parent_ino(dentry);
-               if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)
+               if (dir_emit(ctx, "..", 2, ino, DT_DIR))
                        goto out;
                ctx->pos++;
                /* fall through */
@@ -698,13 +698,13 @@
        switch (ctx->pos) {
        case 0:
                ino = inode->i_ino;
-               if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
+               if ( dir_emit(ctx, ".", 1, ino, DT_DIR) )
                        goto out;
                ctx->pos++;
                /* fall through */
        case 1:
                ino = parent_ino(dentry);
-               if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)
+               if (dir_emit(ctx, "..", 2, ino, DT_DIR))
                        goto out;
                ctx->pos++;
                /* fall through */
@@ -851,13 +851,13 @@
        switch (ctx->pos) {
        case 0:
                ino = inode->i_ino;
-               if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
+               if ( dir_emit(ctx, ".", 1, ino, DT_DIR) )
                        goto out;
                ctx->pos++;
                /* fall through */
        case 1:
                ino = parent_ino(dentry);
-               if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)
+               if (dir_emit(ctx, "..", 2, ino, DT_DIR))
                        goto out;
                ctx->pos++;
                /* fall through */
@@ -932,13 +932,13 @@
        switch (ctx->pos) {
        case 0:
                ino = inode->i_ino;
-               if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
+               if ( dir_emit(ctx, ".", 1, ino, DT_DIR) )
                        goto out;
                ctx->pos++;
                /* fall through */
        case 1:
                ino = parent_ino(dentry);
-               if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)
+               if (dir_emit(ctx, "..", 2, ino, DT_DIR))
                        goto out;
                ctx->pos++;
                /* fall through */
---------------------------------------

solve the :

kernel/vserver/proc.c: In function ‘proc_xid_iterate’:
kernel/vserver/proc.c:620:43: warning: comparison of constant ‘0’ with boolean expression
is always false [-Wbool-compare]
   if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
                                           ^
kernel/vserver/proc.c:626:44: warning: comparison of constant ‘0’ with boolean expression
is always false [-Wbool-compare]
   if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)
                                            ^
kernel/vserver/proc.c: In function ‘proc_nid_iterate’:
kernel/vserver/proc.c:701:43: warning: comparison of constant ‘0’ with boolean expression
is always false [-Wbool-compare]
   if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
                                           ^
kernel/vserver/proc.c:707:44: warning: comparison of constant ‘0’ with boolean expression
is always false [-Wbool-compare]
   if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)
                                            ^
kernel/vserver/proc.c: In function ‘proc_virtual_iterate’:
kernel/vserver/proc.c:854:43: warning: comparison of constant ‘0’ with boolean expression
is always false [-Wbool-compare]
   if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
                                           ^
kernel/vserver/proc.c:860:44: warning: comparison of constant ‘0’ with boolean expression
is always false [-Wbool-compare]
   if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)
                                            ^
kernel/vserver/proc.c: In function ‘proc_virtnet_iterate’:
kernel/vserver/proc.c:935:43: warning: comparison of constant ‘0’ with boolean expression
is always false [-Wbool-compare]
   if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
                                           ^
kernel/vserver/proc.c:941:44: warning: comparison of constant ‘0’ with boolean expression
is always false [-Wbool-compare]
   if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)


in the right way ?


best regards,
Ghislain.