Re: [PATCH v4 2/8] ACPI: property: Parse _CRS CSI-2 descriptor

Philip Li
2023-02-09T02:48:36Z

On Thu, Feb 09, 2023 at 05:04:11AM +0800, kernel test robot wrote:
> Hi Sakari,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on rafael-pm/linux-next]
> [also build test WARNING on sailus-media-tree/streams linus/master v6.2-rc7 next-20230208]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Sakari-Ailus/ACPI-property-Parse-data-node-string-references-in-properties/20230208-233112
> base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
> patch link: https://lore.kernel.org/r/20230208152807.3064242-3-sakari.ailus%40linux.intel.com
> patch subject: [PATCH v4 2/8] ACPI: property: Parse _CRS CSI-2 descriptor
> config: x86_64-rhel-8.3-syz (https://download.01.org/0day-ci/archive/20230209/202302090459.kIM95vle-lkp@intel.com/config)
> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
> reproduce (this is a W=1 build):
> # https://github.com/intel-lab-lkp/linux/commit/d78f47f2d5051c50bdcea131da1779ec0fc8e266
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Sakari-Ailus/ACPI-property-Parse-data-node-string-references-in-properties/20230208-233112
> git checkout d78f47f2d5051c50bdcea131da1779ec0fc8e266
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> make W=1 O=build_dir ARCH=x86_64 olddefconfig
> make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/acpi/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Link: https://lore.kernel.org/oe-kbuild-all/20230208152807.3064242-3-sakari.ailus@linux.intel.com

Sorry that the link is wrong, it should be
Link: https://lore.kernel.org/oe-kbuild-all/202302090459.kIM95vle-lkp@intel.com/

>
> All warnings (new ones prefixed by >>):
>
> >> drivers/acpi/mipi.c:205:6: warning: no previous prototype for 'acpi_crs_csi2_alloc_fill_swnodes' [-Wmissing-prototypes]
> 205 | void acpi_crs_csi2_alloc_fill_swnodes(size_t ports_count, acpi_handle handle)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> vim +/acpi_crs_csi2_alloc_fill_swnodes +205 drivers/acpi/mipi.c
>
> 200
> 201 /*
> 202 * Allocate memory and set up software nodes for an ACPI device with given
> 203 * number of CSI-2 ports.
> 204 */
> > 205 void acpi_crs_csi2_alloc_fill_swnodes(size_t ports_count, acpi_handle handle)
> 206 {
> 207 struct acpi_device_software_nodes *ads;
> 208 struct crs_csi2_swnodes *swnodes;
> 209 size_t alloc_size;
> 210 unsigned int i;
> 211 bool overflow;
> 212 void *end;
> 213
> 214 /*
> 215 * Allocate memory for ports, node pointers (number of nodes +
> 216 * 1 (guardian), nodes (root + number of ports * 2 (for for
> 217 * every port there is an endpoint)).
> 218 */
> 219 overflow = check_mul_overflow(sizeof(*ads->ports) +
> 220 sizeof(*ads->nodes) * 2 +
> 221 sizeof(*ads->nodeptrs) * 2,
> 222 ports_count, &alloc_size);
> 223 overflow = overflow ||
> 224 check_add_overflow(sizeof(*ads) + sizeof(*ads->nodes) +
> 225 sizeof(*ads->nodeptrs) * 2,
> 226 alloc_size, &alloc_size);
> 227 if (overflow) {
> 228 acpi_handle_warn(handle,
> 229 "too many _CRS CSI2 resource handles (%zu)",
> 230 ports_count);
> 231 return;
> 232 }
> 233
> 234 swnodes = kzalloc(sizeof(*swnodes), GFP_KERNEL);
> 235 ads = kzalloc(alloc_size, GFP_KERNEL);
> 236 ads->ports = (void *)(ads + 1);
> 237 ads->nodes = (void *)(ads->ports + ports_count);
> 238 ads->nodeptrs = (void *)(ads->nodes +
> 239 ports_count * 2 + 1);
> 240 end = ads->nodeptrs + ports_count * 2 + 2;
> 241 if (!swnodes || !ads || WARN_ON((void *)ads + alloc_size != end)) {
> 242 kfree(swnodes);
> 243 kfree(ads);
> 244 acpi_handle_debug(handle,
> 245 "cannot allocate for %zu software nodes\n",
> 246 ports_count);
> 247 return;
> 248 }
> 249
> 250 ads->num_ports = ports_count;
> 251 for (i = 0; i < ports_count * 2 + 1; i++)
> 252 ads->nodeptrs[i] = &ads->nodes[i];
> 253 ads->nodeptrs[i] = NULL;
> 254 for (i = 0; i < ports_count; i++)
> 255 ads->ports[i].port_nr = NO_CSI2_PORT;
> 256 swnodes->handle = handle;
> 257 swnodes->ads = ads;
> 258 list_add(&swnodes->list, &crs_csi2_swnodes);
> 259 }
> 260
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests
>