Hi Florinel,
FYI, the error/warning still remains.
tree:
https://github.com/Freescale/linux-fslc 5.10-2.1.x-imx
head: 97b03e732ae16a3b30736ac12cf838a5c2db3eca
commit: 1db839bda044bf4568b6d9191a6a850ba89dbe67 [8935/16146] fsl_qbman: usdpaa: clear
ioctl_dma_map string buffers
config: arm-defconfig
(
https://download.01.org/0day-ci/archive/20211211/202112110452.IVQo1Vuf-lk...)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://github.com/Freescale/linux-fslc/commit/1db839bda044bf4568b6d9191a...
git remote add freescale-fslc
https://github.com/Freescale/linux-fslc
git fetch --no-tags freescale-fslc 5.10-2.1.x-imx
git checkout 1db839bda044bf4568b6d9191a6a850ba89dbe67
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir
ARCH=arm SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from include/linux/fsl_usdpaa.h:17,
from drivers/staging/fsl_qbman/dpa_sys.h:66,
from drivers/staging/fsl_qbman/fsl_usdpaa.c:29:
include/linux/fsl_qman.h:415:1: error: alignment 1 of 'struct qm_eqcr_entry' is
less than 8 [-Werror=packed-not-aligned]
415 | } __packed;
| ^
include/linux/fsl_qman.h:469:17: error: alignment 1 of 'struct
<anonymous>' is less than 8 [-Werror=packed-not-aligned]
469 | } __packed ern;
| ^
include/linux/fsl_qman.h:468:38: error: 'fd' offset 15 in 'struct
<anonymous>' isn't aligned to 8 [-Werror=packed-not-aligned]
468 | struct qm_fd fd;
| ^~
include/linux/fsl_qman.h:486:17: error: alignment 1 of 'struct
<anonymous>' is less than 8 [-Werror=packed-not-aligned]
486 | } __packed dcern;
| ^
include/linux/fsl_qman.h:485:38: error: 'fd' offset 15 in 'struct
<anonymous>' isn't aligned to 8 [-Werror=packed-not-aligned]
485 | struct qm_fd fd;
| ^~
include/linux/fsl_qman.h:1679:1: error: alignment 1 of 'struct
qm_mcr_ceetm_cq_peek_pop_xsfdrread' is less than 8 [-Werror=packed-not-aligned]
1679 | } __packed;
| ^
include/linux/fsl_qman.h:1677:22: error: 'fd' offset 14 in 'struct
qm_mcr_ceetm_cq_peek_pop_xsfdrread' isn't aligned to 8
[-Werror=packed-not-aligned]
1677 | struct qm_fd fd;
| ^~
In file included from drivers/staging/fsl_qbman/fsl_usdpaa.c:32:
drivers/staging/fsl_qbman/qman_low.h: In function 'qm_shutdown_fq':
drivers/staging/fsl_qbman/qman_low.h:1291:29: error: variable 'dequeue_wq' set
but not used [-Werror=unused-but-set-variable]
1291 | u16 dequeue_wq = 0;
| ^~~~~~~~~~
drivers/staging/fsl_qbman/fsl_usdpaa.c: At top level:
drivers/staging/fsl_qbman/fsl_usdpaa.c:406:6: error: no previous prototype for
'dbci_portal' [-Werror=missing-prototypes]
406 | void dbci_portal(void *addr)
| ^~~~~~~~~~~
drivers/staging/fsl_qbman/fsl_usdpaa.c: In function 'ioctl_dma_map':
> drivers/staging/fsl_qbman/fsl_usdpaa.c:1161:17: error:
'strncpy' output may be truncated copying 15 bytes from a string of length 15
[-Werror=stringop-truncation]
1161 |
strncpy(start_frag->name, i->name, USDPAA_DMA_NAME_MAX - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
vim +/strncpy +1161 drivers/staging/fsl_qbman/fsl_usdpaa.c
1006
1007 static long ioctl_dma_map(struct file *fp, struct ctx *ctx,
1008 struct usdpaa_ioctl_dma_map *i)
1009 {
1010 struct mem_fragment *frag, *start_frag, *next_frag;
1011 struct mem_mapping *map, *tmp;
1012 int ret = 0;
1013 u32 largest_page, so_far = 0;
1014 int frag_count = 0;
1015 unsigned long next_addr = PAGE_SIZE, populate;
1016
1017 /* error checking to ensure values copied from user space are valid */
1018 if (i->len % PAGE_SIZE)
1019 return -EINVAL;
1020
1021 map = kmalloc(sizeof(*map), GFP_KERNEL);
1022 if (!map)
1023 return -ENOMEM;
1024
1025 spin_lock(&mem_lock);
1026 if (i->flags & USDPAA_DMA_FLAG_SHARE) {
1027 list_for_each_entry(frag, &mem_list, list) {
1028 if (frag->refs && (frag->flags &
1029 USDPAA_DMA_FLAG_SHARE) &&
1030 !strncmp(i->name, frag->name,
1031 USDPAA_DMA_NAME_MAX)) {
1032 /* Matching entry */
1033 if ((i->flags & USDPAA_DMA_FLAG_CREATE) &&
1034 !(i->flags & USDPAA_DMA_FLAG_LAZY)) {
1035 ret = -EBUSY;
1036 goto out;
1037 }
1038
1039 /* Check to ensure size matches record */
1040 if (i->len != frag->map_len && i->len) {
1041 pr_err("ioctl_dma_map() Size requested does not match %s and is none
zero\n",
1042 frag->name);
1043 ret = -EINVAL;
1044 goto out;
1045 }
1046
1047 /* Check if this has already been mapped
1048 to this process */
1049 list_for_each_entry(tmp, &ctx->maps, list)
1050 if (tmp->root_frag == frag) {
1051 /* Already mapped, just need to
1052 inc ref count */
1053 tmp->refs++;
1054 kfree(map);
1055 i->did_create = 0;
1056 i->len = tmp->total_size;
1057 i->phys_addr = frag->base;
1058 i->ptr = tmp->virt_addr;
1059 spin_unlock(&mem_lock);
1060 return 0;
1061 }
1062 /* Matching entry - just need to map */
1063 i->has_locking = frag->has_locking;
1064 i->did_create = 0;
1065 i->len = frag->map_len;
1066 start_frag = frag;
1067 goto do_map;
1068 }
1069 }
1070 /* No matching entry */
1071 if (!(i->flags & USDPAA_DMA_FLAG_CREATE)) {
1072 pr_err("ioctl_dma_map() No matching entry\n");
1073 ret = -ENOMEM;
1074 goto out;
1075 }
1076 }
1077 /* New fragment required, size must be provided. */
1078 if (!i->len) {
1079 ret = -EINVAL;
1080 goto out;
1081 }
1082
1083 /* Find one of more contiguous fragments that satisfy the total length
1084 trying to minimize the number of fragments
1085 compute the largest page size that the allocation could use */
1086 largest_page = largest_page_size(i->len);
1087 start_frag = NULL;
1088 while (largest_page &&
1089 largest_page <= largest_page_size(phys_size) &&
1090 start_frag == NULL) {
1091 /* Search the list for a frag of that size */
1092 list_for_each_entry(frag, &mem_list, list) {
1093 if (!frag->refs && (frag->len == largest_page)) {
1094 /* See if the next x fragments are free
1095 and can accomidate the size */
1096 u32 found_size = largest_page;
1097 next_frag = list_entry(frag->list.prev,
1098 struct mem_fragment,
1099 list);
1100 /* If the fragement is too small check
1101 if the neighbours cab support it */
1102 while (found_size < i->len) {
1103 if (&mem_list == &next_frag->list)
1104 break; /* End of list */
1105 if (next_frag->refs != 0 ||
1106 next_frag->len == 0)
1107 break; /* not enough space */
1108 found_size += next_frag->len;
1109 next_frag = list_entry(
1110 next_frag->list.prev,
1111 struct mem_fragment,
1112 list);
1113 }
1114 if (found_size >= i->len) {
1115 /* Success! there is enough contigous
1116 free space */
1117 start_frag = frag;
1118 break;
1119 }
1120 }
1121 } /* next frag loop */
1122 /* Couldn't statisfy the request with this
1123 largest page size, try a smaller one */
1124 largest_page <<= 2;
1125 }
1126 if (start_frag == NULL) {
1127 /* Couldn't find proper amount of space */
1128 ret = -ENOMEM;
1129 goto out;
1130 }
1131 i->did_create = 1;
1132 do_map:
1133 /* Verify there is sufficient space to do the mapping */
1134 down_write(¤t->mm->mmap_lock);
1135 next_addr = usdpaa_get_unmapped_area(fp, next_addr, i->len, 0, 0);
1136 up_write(¤t->mm->mmap_lock);
1137
1138 if (next_addr & ~PAGE_MASK) {
1139 ret = -ENOMEM;
1140 goto out;
1141 }
1142
1143 /* We may need to divide the final fragment to accomidate the mapping */
1144 next_frag = start_frag;
1145 while (so_far != i->len) {
1146 BUG_ON(next_frag->len == 0);
1147 while ((next_frag->len + so_far) > i->len) {
1148 /* Split frag until they match */
1149 split_frag(next_frag);
1150 }
1151 so_far += next_frag->len;
1152 next_frag->refs++;
1153 ++frag_count;
1154 next_frag = list_entry(next_frag->list.prev,
1155 struct mem_fragment, list);
1156 }
1157 if (i->did_create) {
1158 size_t name_len = 0;
1159 start_frag->flags = i->flags;
1160 memset(start_frag->name, '\0', USDPAA_DMA_NAME_MAX);
1161 strncpy(start_frag->name, i->name, USDPAA_DMA_NAME_MAX -
1);
1162 name_len = strnlen(start_frag->name, USDPAA_DMA_NAME_MAX);
1163 if (name_len >= USDPAA_DMA_NAME_MAX) {
1164 ret = -EFAULT;
1165 goto out;
1166 }
1167 start_frag->map_len = i->len;
1168 start_frag->has_locking = i->has_locking;
1169 init_waitqueue_head(&start_frag->wq);
1170 start_frag->owner = NULL;
1171 }
1172
1173 /* Setup the map entry */
1174 map->root_frag = start_frag;
1175 map->total_size = i->len;
1176 map->frag_count = frag_count;
1177 map->refs = 1;
1178 list_add(&map->list, &ctx->maps);
1179 i->phys_addr = start_frag->base;
1180 out:
1181 spin_unlock(&mem_lock);
1182
1183 if (!ret) {
1184 unsigned long longret;
1185 down_write(¤t->mm->mmap_lock);
1186 longret = do_mmap(fp, next_addr, map->total_size,
1187 PROT_READ |
1188 (i->flags &
1189 USDPAA_DMA_FLAG_RDONLY ? 0
1190 : PROT_WRITE),
1191 MAP_SHARED,
1192 start_frag->pfn_base,
1193 &populate,
1194 NULL);
1195 up_write(¤t->mm->mmap_lock);
1196 if (longret & ~PAGE_MASK) {
1197 ret = (int)longret;
1198 } else {
1199 i->ptr = (void *)longret;
1200 map->virt_addr = i->ptr;
1201 }
1202 } else
1203 kfree(map);
1204 return ret;
1205 }
1206
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org