Sorry for messy encoding...

We met the following warning when build linux-yocto v6.1, introduced by latter 
diff. It perhaps miscalculates the buf length.

fs/yaffs2/yaffs_vfs.c:122:29: warning: argument to 'sizeof' in 'snprintf' call 
is the same expression as the destination; did you mean to provide an explicit 
length? [-Wsizeof-pointer-memaccess]

--- a/fs/yaffs2/yaffs_vfs.c
+++ b/fs/yaffs2/yaffs_vfs.c
@@ -117,7 +117,11 @@
 #define Page_Uptodate(page) test_bit(PG_uptodate, &(page)->flags)
 
 /* FIXME: use sb->s_id instead ? */
-#define yaffs_devname(sb, buf) bdevname(sb->s_bdev, buf)
+//#define yaffs_devname(sb, buf) bdevname(sb->s_bdev, buf)
+static inline char* yaffs_devname(struct super_block *sb, char *buf) {
+       snprintf(buf, sizeof(buf), "%pg", sb->s_bdev);
+       return buf;
+}
 
 #else
 


Thanks,
Zhe

On 5/30/23 11:34, He Zhe via lists.yoctoproject.org wrote:
> |Hi Bruce, We met the following warning when build linux-yocto v6.1, 
> introduced by latter diff. It perhaps miscalculates the buf length. 
> fs/yaffs2/yaffs_vfs.c:122:29: warning: argument to 'sizeof' in 'snprintf' 
> call is the same expression as the destination; did you mean to provide an 
> explicit length? [-Wsizeof-pointer-memaccess] --- a/fs/yaffs2/yaffs_vfs.c +++ 
> b/fs/yaffs2/yaffs_vfs.c @@ -117,7 +117,11 @@  #define Page_Uptodate(page) 
> test_bit(PG_uptodate, &(page)->flags)    /* FIXME: use sb->s_id instead ? */ 
> -#define yaffs_devname(sb, buf) bdevname(sb->s_bdev, buf) +//#define 
> yaffs_devname(sb, buf) bdevname(sb->s_bdev, buf) +static inline char* 
> yaffs_devname(struct super_block *sb, char *buf) { +       snprintf(buf, 
> sizeof(buf), "%pg", sb->s_bdev); +       return buf; +}    #else   Thanks, 
> Zhe |
>
>
> 
>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12658): 
https://lists.yoctoproject.org/g/linux-yocto/message/12658
Mute This Topic: https://lists.yoctoproject.org/mt/99213494/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to