lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 20 Oct 2022 10:41:10 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Mikko Perttunen <mperttunen@...dia.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Thierry Reding <treding@...dia.com>
Subject: drivers/gpu/host1x/context.c:77 host1x_memory_context_list_init()
 warn: missing error code 'err'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   aae703b02f92bde9264366c545e87cec451de471
commit: 8aa5bcb61612060429223d1fbb7a1c30a579fc1f gpu: host1x: Add context device management code
config: arm-randconfig-m031-20221019
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
drivers/gpu/host1x/context.c:77 host1x_memory_context_list_init() warn: missing error code 'err'

vim +/err +77 drivers/gpu/host1x/context.c

8aa5bcb6161206 Mikko Perttunen 2022-06-27  16  int host1x_memory_context_list_init(struct host1x *host1x)
8aa5bcb6161206 Mikko Perttunen 2022-06-27  17  {
8aa5bcb6161206 Mikko Perttunen 2022-06-27  18  	struct host1x_memory_context_list *cdl = &host1x->context_list;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  19  	struct device_node *node = host1x->dev->of_node;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  20  	struct host1x_memory_context *ctx;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  21  	unsigned int i;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  22  	int err;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  23  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  24  	cdl->devs = NULL;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  25  	cdl->len = 0;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  26  	mutex_init(&cdl->lock);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  27  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  28  	err = of_property_count_u32_elems(node, "iommu-map");
8aa5bcb6161206 Mikko Perttunen 2022-06-27  29  	if (err < 0)
8aa5bcb6161206 Mikko Perttunen 2022-06-27  30  		return 0;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  31  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  32  	cdl->devs = kcalloc(err, sizeof(*cdl->devs), GFP_KERNEL);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  33  	if (!cdl->devs)
8aa5bcb6161206 Mikko Perttunen 2022-06-27  34  		return -ENOMEM;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  35  	cdl->len = err / 4;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  36  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  37  	for (i = 0; i < cdl->len; i++) {
8aa5bcb6161206 Mikko Perttunen 2022-06-27  38  		struct iommu_fwspec *fwspec;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  39  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  40  		ctx = &cdl->devs[i];
8aa5bcb6161206 Mikko Perttunen 2022-06-27  41  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  42  		ctx->host = host1x;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  43  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  44  		device_initialize(&ctx->dev);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  45  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  46  		/*
8aa5bcb6161206 Mikko Perttunen 2022-06-27  47  		 * Due to an issue with T194 NVENC, only 38 bits can be used.
8aa5bcb6161206 Mikko Perttunen 2022-06-27  48  		 * Anyway, 256GiB of IOVA ought to be enough for anyone.
8aa5bcb6161206 Mikko Perttunen 2022-06-27  49  		 */
8aa5bcb6161206 Mikko Perttunen 2022-06-27  50  		ctx->dma_mask = DMA_BIT_MASK(38);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  51  		ctx->dev.dma_mask = &ctx->dma_mask;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  52  		ctx->dev.coherent_dma_mask = ctx->dma_mask;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  53  		dev_set_name(&ctx->dev, "host1x-ctx.%d", i);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  54  		ctx->dev.bus = &host1x_context_device_bus_type;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  55  		ctx->dev.parent = host1x->dev;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  56  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  57  		dma_set_max_seg_size(&ctx->dev, UINT_MAX);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  58  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  59  		err = device_add(&ctx->dev);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  60  		if (err) {
8aa5bcb6161206 Mikko Perttunen 2022-06-27  61  			dev_err(host1x->dev, "could not add context device %d: %d\n", i, err);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  62  			goto del_devices;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  63  		}
8aa5bcb6161206 Mikko Perttunen 2022-06-27  64  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  65  		err = of_dma_configure_id(&ctx->dev, node, true, &i);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  66  		if (err) {
8aa5bcb6161206 Mikko Perttunen 2022-06-27  67  			dev_err(host1x->dev, "IOMMU configuration failed for context device %d: %d\n",
8aa5bcb6161206 Mikko Perttunen 2022-06-27  68  				i, err);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  69  			device_del(&ctx->dev);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  70  			goto del_devices;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  71  		}
8aa5bcb6161206 Mikko Perttunen 2022-06-27  72  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  73  		fwspec = dev_iommu_fwspec_get(&ctx->dev);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  74  		if (!fwspec || !device_iommu_mapped(&ctx->dev)) {
8aa5bcb6161206 Mikko Perttunen 2022-06-27  75  			dev_err(host1x->dev, "Context device %d has no IOMMU!\n", i);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  76  			device_del(&ctx->dev);
8aa5bcb6161206 Mikko Perttunen 2022-06-27 @77  			goto del_devices;

Set error code here?

8aa5bcb6161206 Mikko Perttunen 2022-06-27  78  		}
8aa5bcb6161206 Mikko Perttunen 2022-06-27  79  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  80  		ctx->stream_id = fwspec->ids[0] & 0xffff;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  81  	}
8aa5bcb6161206 Mikko Perttunen 2022-06-27  82  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  83  	return 0;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  84  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  85  del_devices:
8aa5bcb6161206 Mikko Perttunen 2022-06-27  86  	while (i--)
8aa5bcb6161206 Mikko Perttunen 2022-06-27  87  		device_del(&cdl->devs[i].dev);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  88  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  89  	kfree(cdl->devs);
8aa5bcb6161206 Mikko Perttunen 2022-06-27  90  	cdl->len = 0;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  91  
8aa5bcb6161206 Mikko Perttunen 2022-06-27  92  	return err;
8aa5bcb6161206 Mikko Perttunen 2022-06-27  93  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ