Milos Nikic, le sam. 04 avril 2026 18:25:58 -0700, a ecrit:
> diff --git a/libdiskfs/file-get-trans.c b/libdiskfs/file-get-trans.c
> index b0a4b4ee..6e923424 100644
> --- a/libdiskfs/file-get-trans.c
> +++ b/libdiskfs/file-get-trans.c
> @@ -93,7 +102,7 @@ diskfs_S_file_get_translator (struct protid *cred,
>         *translen = len;
>       }
>        else if (len > *translen)
> -     munmap (trans, len);
> +     munmap ((void *)trans, len);

Again, useless in C. That's precisely why read()/write() etc. take a
void*, so we don't have to cast.

>      }
>    else if (S_ISCHR (np->dn_stat.st_mode) || S_ISBLK (np->dn_stat.st_mode))
>      {


> diff --git a/libdiskfs/file-getfh.c b/libdiskfs/file-getfh.c
> index 8023a14f..37573662 100644
> --- a/libdiskfs/file-getfh.c
> +++ b/libdiskfs/file-getfh.c
> @@ -57,7 +65,7 @@ diskfs_S_file_getfh (struct protid *cred, data_t *fh,
>  
>    pthread_mutex_lock (&node->lock);
>  
> -  f->data.cache_id = node->cache_id;
> +  f->data.cache_id = (int)node->cache_id;

Again, this is just silencing a warning, and possibly actually hiding a
bug rather than fixing it.

Warnings are not there to be silenced. They are there to be understood
and fixed, and only sometimes, once fully understood, to be silenced.

Here we have a 64b/32b size issue, so we need to *actually* check
whether it's fine to truncate, or rather report some kind of error, or
cope with it some way, etc.

AFAIK, file_getfh is used only by nfsd, so the meaning for nfs should be
checked, etc.

And until somebody does that, we do *not* want to hide the warning.

>    f->data.gen = node->dn_stat.st_gen;
>  
>    pthread_mutex_unlock (&node->lock);


> diff --git a/libdiskfs/file-sync.c b/libdiskfs/file-sync.c
> index 20fa005c..2f3d02a1 100644
> --- a/libdiskfs/file-sync.c
> +++ b/libdiskfs/file-sync.c
> @@ -15,7 +15,13 @@
>     along with this program; if not, write to the Free Software
>     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
>  
> -#include "priv.h"
> +#include <errno.h>
> +#include <pthread.h>
> +
> +#include <hurd/iohelp.h>
> +#include <libdiskfs/diskfs.h>
> +#include <libiohelp/iohelp.h>
> +#include <mach/machine/kern_return.h>
>  #include "fs_S.h"
>  
>  /* Implement file_sync as described in <hurd/fs.defs>. */
> @@ -24,6 +30,7 @@ diskfs_S_file_sync (struct protid *cred,
>                   int wait,
>                   int omitmetadata)
>  {
> +  (void) omitmetadata;

Again, this is silencing, but why would it be fine to ignore the
omitmetadata parameter? We would probably want to put a comment to
explain why we wouldn't care about the omitmetadata value.

>    struct node *np;
>  
>    if (!cred)
> diff --git a/libdiskfs/fsys-getfile.c b/libdiskfs/fsys-getfile.c
> index b80c2869..38714bba 100644
> --- a/libdiskfs/fsys-getfile.c
> +++ b/libdiskfs/fsys-getfile.c
> @@ -64,7 +78,7 @@ diskfs_S_fsys_getfile (struct diskfs_control *pt,
>        return ESTALE;
>      }
>  
> -  err = iohelp_create_complex_iouser (&user, uids, nuids, gids, ngids);
> +  err = iohelp_create_complex_iouser (&user, uids, (int) nuids, gids, (int) 
> ngids);

Again, what about nuids being so large that casting to int makes it
negative? We don't want to just silence and forget (and still have
bugs), we want to take the warning into account.

It happens that inside iohelp_create_complex_iouser, it's used as
unsigned. So perhaps the fix is actually to change the prototype of
iohelp_create_complex_iouser (and probably some others) into taking
unsigned.

Samuel

Reply via email to