public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj
@ 2026-03-16  9:25 Loke Forsberg
  2026-03-17 17:44 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Loke Forsberg @ 2026-03-16  9:25 UTC (permalink / raw)
  To: linux-usb; +Cc: gregkh, khtsai, raubcameo, kees, linux-kernel, Loke Forsberg

Replace kzalloc(sizeof(*ptr)) with kzalloc_obj(), to improve type safety.

Signed-off-by: Loke Forsberg <Loke.Forsberg@gmail.com>
---
Changes in v2:
  - Remove GFP_KERNEL flag as kzalloc_obj() defaults to it

 drivers/usb/gadget/function/f_ncm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
index 14fc7dce6f39..1bec7e99b04f 100644
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -1456,7 +1456,7 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
 		return -EINVAL;
 
 	if (cdev->use_os_string) {
-		os_desc_table = kzalloc(sizeof(*os_desc_table), GFP_KERNEL);
+		os_desc_table = kzalloc_obj(os_desc_table);
 		if (!os_desc_table)
 			return -ENOMEM;
 	}
@@ -1753,7 +1753,7 @@ static struct usb_function *ncm_alloc(struct usb_function_instance *fi)
 	struct f_ncm_opts	*opts;
 
 	/* allocate and initialize one new instance */
-	ncm = kzalloc(sizeof(*ncm), GFP_KERNEL);
+	ncm = kzalloc_obj(ncm);
 	if (!ncm)
 		return ERR_PTR(-ENOMEM);
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj
  2026-03-16  9:25 [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj Loke Forsberg
@ 2026-03-17 17:44 ` kernel test robot
  2026-03-17 17:44 ` kernel test robot
  2026-03-18 14:10 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-03-17 17:44 UTC (permalink / raw)
  To: Loke Forsberg, linux-usb
  Cc: oe-kbuild-all, gregkh, khtsai, raubcameo, kees, linux-kernel,
	Loke Forsberg

Hi Loke,

kernel test robot noticed the following build errors:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus westeri-thunderbolt/next linus/master v7.0-rc4 next-20260316]
[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/Loke-Forsberg/usb-gadget-f_ncm-replace-kzalloc-with-kzalloc_obj/20260316-173026
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20260316092505.8841-1-Loke.Forsberg%40gmail.com
patch subject: [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj
config: riscv-randconfig-002-20260317 (https://download.01.org/0day-ci/archive/20260318/202603180113.YgfMQGgX-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260318/202603180113.YgfMQGgX-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603180113.YgfMQGgX-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/usb/gadget/function/f_ncm.c: In function 'ncm_bind':
>> drivers/usb/gadget/function/f_ncm.c:1459:17: error: assignment to 'struct usb_os_desc_table *' from incompatible pointer type 'struct usb_os_desc_table **' [-Werror=incompatible-pointer-types]
      os_desc_table = kzalloc_obj(os_desc_table);
                    ^
   drivers/usb/gadget/function/f_ncm.c: In function 'ncm_alloc':
>> drivers/usb/gadget/function/f_ncm.c:1756:6: error: assignment to 'struct f_ncm *' from incompatible pointer type 'struct f_ncm **' [-Werror=incompatible-pointer-types]
     ncm = kzalloc_obj(ncm);
         ^
   cc1: some warnings being treated as errors


vim +1459 drivers/usb/gadget/function/f_ncm.c

  1441	
  1442	static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
  1443	{
  1444		struct usb_composite_dev *cdev = c->cdev;
  1445		struct f_ncm		*ncm = func_to_ncm(f);
  1446		struct f_ncm_opts	*ncm_opts = func_to_ncm_opts(f);
  1447		struct usb_string	*us;
  1448		int			status = 0;
  1449		struct usb_ep		*ep;
  1450	
  1451		struct usb_os_desc_table	*os_desc_table __free(kfree) = NULL;
  1452		struct net_device		*netdev __free(free_gether_netdev) = NULL;
  1453		struct usb_request		*request __free(free_usb_request) = NULL;
  1454	
  1455		if (!can_support_ecm(cdev->gadget))
  1456			return -EINVAL;
  1457	
  1458		if (cdev->use_os_string) {
> 1459			os_desc_table = kzalloc_obj(os_desc_table);
  1460			if (!os_desc_table)
  1461				return -ENOMEM;
  1462		}
  1463	
  1464		netdev = gether_setup_default();
  1465		if (IS_ERR(netdev))
  1466			return -ENOMEM;
  1467	
  1468		scoped_guard(mutex, &ncm_opts->lock) {
  1469			gether_apply_opts(netdev, &ncm_opts->net_opts);
  1470			netdev->mtu = ncm_opts->max_segment_size - ETH_HLEN;
  1471		}
  1472	
  1473		gether_set_gadget(netdev, cdev->gadget);
  1474		status = gether_register_netdev(netdev);
  1475		if (status)
  1476			return status;
  1477	
  1478		/* export host's Ethernet address in CDC format */
  1479		status = gether_get_host_addr_cdc(netdev, ncm->ethaddr,
  1480						  sizeof(ncm->ethaddr));
  1481		if (status < 12)
  1482			return -EINVAL;
  1483		ncm_string_defs[STRING_MAC_IDX].s = ncm->ethaddr;
  1484	
  1485		us = usb_gstrings_attach(cdev, ncm_strings,
  1486					 ARRAY_SIZE(ncm_string_defs));
  1487		if (IS_ERR(us))
  1488			return PTR_ERR(us);
  1489	
  1490		ncm_control_intf.iInterface = us[STRING_CTRL_IDX].id;
  1491		ncm_data_nop_intf.iInterface = us[STRING_DATA_IDX].id;
  1492		ncm_data_intf.iInterface = us[STRING_DATA_IDX].id;
  1493		ecm_desc.iMACAddress = us[STRING_MAC_IDX].id;
  1494		ncm_iad_desc.iFunction = us[STRING_IAD_IDX].id;
  1495	
  1496		/* allocate instance-specific interface IDs */
  1497		status = usb_interface_id(c, f);
  1498		if (status < 0)
  1499			return status;
  1500		ncm->ctrl_id = status;
  1501		ncm_iad_desc.bFirstInterface = status;
  1502	
  1503		ncm_control_intf.bInterfaceNumber = status;
  1504		ncm_union_desc.bMasterInterface0 = status;
  1505	
  1506		status = usb_interface_id(c, f);
  1507		if (status < 0)
  1508			return status;
  1509		ncm->data_id = status;
  1510	
  1511		ncm_data_nop_intf.bInterfaceNumber = status;
  1512		ncm_data_intf.bInterfaceNumber = status;
  1513		ncm_union_desc.bSlaveInterface0 = status;
  1514	
  1515		ecm_desc.wMaxSegmentSize = cpu_to_le16(ncm_opts->max_segment_size);
  1516	
  1517		/* allocate instance-specific endpoints */
  1518		ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_in_desc);
  1519		if (!ep)
  1520			return -ENODEV;
  1521		ncm->port.in_ep = ep;
  1522	
  1523		ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_out_desc);
  1524		if (!ep)
  1525			return -ENODEV;
  1526		ncm->port.out_ep = ep;
  1527	
  1528		ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_notify_desc);
  1529		if (!ep)
  1530			return -ENODEV;
  1531		ncm->notify = ep;
  1532	
  1533		/* allocate notification request and buffer */
  1534		request = usb_ep_alloc_request(ep, GFP_KERNEL);
  1535		if (!request)
  1536			return -ENOMEM;
  1537		request->buf = kmalloc(NCM_STATUS_BYTECOUNT, GFP_KERNEL);
  1538		if (!request->buf)
  1539			return -ENOMEM;
  1540		request->context = ncm;
  1541		request->complete = ncm_notify_complete;
  1542	
  1543		/*
  1544		 * support all relevant hardware speeds... we expect that when
  1545		 * hardware is dual speed, all bulk-capable endpoints work at
  1546		 * both speeds
  1547		 */
  1548		hs_ncm_in_desc.bEndpointAddress = fs_ncm_in_desc.bEndpointAddress;
  1549		hs_ncm_out_desc.bEndpointAddress = fs_ncm_out_desc.bEndpointAddress;
  1550		hs_ncm_notify_desc.bEndpointAddress =
  1551			fs_ncm_notify_desc.bEndpointAddress;
  1552	
  1553		ss_ncm_in_desc.bEndpointAddress = fs_ncm_in_desc.bEndpointAddress;
  1554		ss_ncm_out_desc.bEndpointAddress = fs_ncm_out_desc.bEndpointAddress;
  1555		ss_ncm_notify_desc.bEndpointAddress =
  1556			fs_ncm_notify_desc.bEndpointAddress;
  1557	
  1558		status = usb_assign_descriptors(f, ncm_fs_function, ncm_hs_function,
  1559				ncm_ss_function, ncm_ss_function);
  1560		if (status)
  1561			return status;
  1562	
  1563		/*
  1564		 * NOTE:  all that is done without knowing or caring about
  1565		 * the network link ... which is unavailable to this code
  1566		 * until we're activated via set_alt().
  1567		 */
  1568	
  1569		ncm->port.open = ncm_open;
  1570		ncm->port.close = ncm_close;
  1571	
  1572		hrtimer_setup(&ncm->task_timer, ncm_tx_timeout, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
  1573	
  1574		if (cdev->use_os_string) {
  1575			os_desc_table[0].os_desc = &ncm_opts->ncm_os_desc;
  1576			os_desc_table[0].if_id = ncm_iad_desc.bFirstInterface;
  1577			f->os_desc_table = no_free_ptr(os_desc_table);
  1578			f->os_desc_n = 1;
  1579		}
  1580		ncm->notify_req = no_free_ptr(request);
  1581		ncm->netdev = no_free_ptr(netdev);
  1582		ncm->port.ioport = netdev_priv(ncm->netdev);
  1583	
  1584		DBG(cdev, "CDC Network: IN/%s OUT/%s NOTIFY/%s\n",
  1585				ncm->port.in_ep->name, ncm->port.out_ep->name,
  1586				ncm->notify->name);
  1587		return 0;
  1588	}
  1589	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj
  2026-03-16  9:25 [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj Loke Forsberg
  2026-03-17 17:44 ` kernel test robot
@ 2026-03-17 17:44 ` kernel test robot
  2026-03-18 14:10 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-03-17 17:44 UTC (permalink / raw)
  To: Loke Forsberg, linux-usb
  Cc: llvm, oe-kbuild-all, gregkh, khtsai, raubcameo, kees,
	linux-kernel, Loke Forsberg

Hi Loke,

kernel test robot noticed the following build errors:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus westeri-thunderbolt/next linus/master v7.0-rc4 next-20260316]
[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/Loke-Forsberg/usb-gadget-f_ncm-replace-kzalloc-with-kzalloc_obj/20260316-173026
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20260316092505.8841-1-Loke.Forsberg%40gmail.com
patch subject: [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj
config: hexagon-randconfig-002-20260317 (https://download.01.org/0day-ci/archive/20260318/202603180133.Mwj8SBgf-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 4abb927bacf37f18f6359a41639a6d1b3bffffb5)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260318/202603180133.Mwj8SBgf-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603180133.Mwj8SBgf-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/usb/gadget/function/f_ncm.c:1459:17: error: incompatible pointer types assigning to 'struct usb_os_desc_table *' from 'typeof (os_desc_table) *' (aka 'struct usb_os_desc_table **'); dereference with * [-Wincompatible-pointer-types]
    1459 |                 os_desc_table = kzalloc_obj(os_desc_table);
         |                               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                 *(                        )
>> drivers/usb/gadget/function/f_ncm.c:1756:6: error: incompatible pointer types assigning to 'struct f_ncm *' from 'typeof (ncm) *' (aka 'struct f_ncm **'); dereference with * [-Wincompatible-pointer-types]
    1756 |         ncm = kzalloc_obj(ncm);
         |             ^ ~~~~~~~~~~~~~~~~
         |               *(              )
   2 errors generated.


vim +1459 drivers/usb/gadget/function/f_ncm.c

  1441	
  1442	static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
  1443	{
  1444		struct usb_composite_dev *cdev = c->cdev;
  1445		struct f_ncm		*ncm = func_to_ncm(f);
  1446		struct f_ncm_opts	*ncm_opts = func_to_ncm_opts(f);
  1447		struct usb_string	*us;
  1448		int			status = 0;
  1449		struct usb_ep		*ep;
  1450	
  1451		struct usb_os_desc_table	*os_desc_table __free(kfree) = NULL;
  1452		struct net_device		*netdev __free(free_gether_netdev) = NULL;
  1453		struct usb_request		*request __free(free_usb_request) = NULL;
  1454	
  1455		if (!can_support_ecm(cdev->gadget))
  1456			return -EINVAL;
  1457	
  1458		if (cdev->use_os_string) {
> 1459			os_desc_table = kzalloc_obj(os_desc_table);
  1460			if (!os_desc_table)
  1461				return -ENOMEM;
  1462		}
  1463	
  1464		netdev = gether_setup_default();
  1465		if (IS_ERR(netdev))
  1466			return -ENOMEM;
  1467	
  1468		scoped_guard(mutex, &ncm_opts->lock) {
  1469			gether_apply_opts(netdev, &ncm_opts->net_opts);
  1470			netdev->mtu = ncm_opts->max_segment_size - ETH_HLEN;
  1471		}
  1472	
  1473		gether_set_gadget(netdev, cdev->gadget);
  1474		status = gether_register_netdev(netdev);
  1475		if (status)
  1476			return status;
  1477	
  1478		/* export host's Ethernet address in CDC format */
  1479		status = gether_get_host_addr_cdc(netdev, ncm->ethaddr,
  1480						  sizeof(ncm->ethaddr));
  1481		if (status < 12)
  1482			return -EINVAL;
  1483		ncm_string_defs[STRING_MAC_IDX].s = ncm->ethaddr;
  1484	
  1485		us = usb_gstrings_attach(cdev, ncm_strings,
  1486					 ARRAY_SIZE(ncm_string_defs));
  1487		if (IS_ERR(us))
  1488			return PTR_ERR(us);
  1489	
  1490		ncm_control_intf.iInterface = us[STRING_CTRL_IDX].id;
  1491		ncm_data_nop_intf.iInterface = us[STRING_DATA_IDX].id;
  1492		ncm_data_intf.iInterface = us[STRING_DATA_IDX].id;
  1493		ecm_desc.iMACAddress = us[STRING_MAC_IDX].id;
  1494		ncm_iad_desc.iFunction = us[STRING_IAD_IDX].id;
  1495	
  1496		/* allocate instance-specific interface IDs */
  1497		status = usb_interface_id(c, f);
  1498		if (status < 0)
  1499			return status;
  1500		ncm->ctrl_id = status;
  1501		ncm_iad_desc.bFirstInterface = status;
  1502	
  1503		ncm_control_intf.bInterfaceNumber = status;
  1504		ncm_union_desc.bMasterInterface0 = status;
  1505	
  1506		status = usb_interface_id(c, f);
  1507		if (status < 0)
  1508			return status;
  1509		ncm->data_id = status;
  1510	
  1511		ncm_data_nop_intf.bInterfaceNumber = status;
  1512		ncm_data_intf.bInterfaceNumber = status;
  1513		ncm_union_desc.bSlaveInterface0 = status;
  1514	
  1515		ecm_desc.wMaxSegmentSize = cpu_to_le16(ncm_opts->max_segment_size);
  1516	
  1517		/* allocate instance-specific endpoints */
  1518		ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_in_desc);
  1519		if (!ep)
  1520			return -ENODEV;
  1521		ncm->port.in_ep = ep;
  1522	
  1523		ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_out_desc);
  1524		if (!ep)
  1525			return -ENODEV;
  1526		ncm->port.out_ep = ep;
  1527	
  1528		ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_notify_desc);
  1529		if (!ep)
  1530			return -ENODEV;
  1531		ncm->notify = ep;
  1532	
  1533		/* allocate notification request and buffer */
  1534		request = usb_ep_alloc_request(ep, GFP_KERNEL);
  1535		if (!request)
  1536			return -ENOMEM;
  1537		request->buf = kmalloc(NCM_STATUS_BYTECOUNT, GFP_KERNEL);
  1538		if (!request->buf)
  1539			return -ENOMEM;
  1540		request->context = ncm;
  1541		request->complete = ncm_notify_complete;
  1542	
  1543		/*
  1544		 * support all relevant hardware speeds... we expect that when
  1545		 * hardware is dual speed, all bulk-capable endpoints work at
  1546		 * both speeds
  1547		 */
  1548		hs_ncm_in_desc.bEndpointAddress = fs_ncm_in_desc.bEndpointAddress;
  1549		hs_ncm_out_desc.bEndpointAddress = fs_ncm_out_desc.bEndpointAddress;
  1550		hs_ncm_notify_desc.bEndpointAddress =
  1551			fs_ncm_notify_desc.bEndpointAddress;
  1552	
  1553		ss_ncm_in_desc.bEndpointAddress = fs_ncm_in_desc.bEndpointAddress;
  1554		ss_ncm_out_desc.bEndpointAddress = fs_ncm_out_desc.bEndpointAddress;
  1555		ss_ncm_notify_desc.bEndpointAddress =
  1556			fs_ncm_notify_desc.bEndpointAddress;
  1557	
  1558		status = usb_assign_descriptors(f, ncm_fs_function, ncm_hs_function,
  1559				ncm_ss_function, ncm_ss_function);
  1560		if (status)
  1561			return status;
  1562	
  1563		/*
  1564		 * NOTE:  all that is done without knowing or caring about
  1565		 * the network link ... which is unavailable to this code
  1566		 * until we're activated via set_alt().
  1567		 */
  1568	
  1569		ncm->port.open = ncm_open;
  1570		ncm->port.close = ncm_close;
  1571	
  1572		hrtimer_setup(&ncm->task_timer, ncm_tx_timeout, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
  1573	
  1574		if (cdev->use_os_string) {
  1575			os_desc_table[0].os_desc = &ncm_opts->ncm_os_desc;
  1576			os_desc_table[0].if_id = ncm_iad_desc.bFirstInterface;
  1577			f->os_desc_table = no_free_ptr(os_desc_table);
  1578			f->os_desc_n = 1;
  1579		}
  1580		ncm->notify_req = no_free_ptr(request);
  1581		ncm->netdev = no_free_ptr(netdev);
  1582		ncm->port.ioport = netdev_priv(ncm->netdev);
  1583	
  1584		DBG(cdev, "CDC Network: IN/%s OUT/%s NOTIFY/%s\n",
  1585				ncm->port.in_ep->name, ncm->port.out_ep->name,
  1586				ncm->notify->name);
  1587		return 0;
  1588	}
  1589	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj
  2026-03-16  9:25 [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj Loke Forsberg
  2026-03-17 17:44 ` kernel test robot
  2026-03-17 17:44 ` kernel test robot
@ 2026-03-18 14:10 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-03-18 14:10 UTC (permalink / raw)
  To: Loke Forsberg; +Cc: linux-usb, khtsai, raubcameo, kees, linux-kernel

On Mon, Mar 16, 2026 at 10:25:05AM +0100, Loke Forsberg wrote:
> Replace kzalloc(sizeof(*ptr)) with kzalloc_obj(), to improve type safety.
> 
> Signed-off-by: Loke Forsberg <Loke.Forsberg@gmail.com>
> ---
> Changes in v2:
>   - Remove GFP_KERNEL flag as kzalloc_obj() defaults to it

Any reason you did not even test build this?

Please be more careful in the future.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-18 14:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16  9:25 [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj Loke Forsberg
2026-03-17 17:44 ` kernel test robot
2026-03-17 17:44 ` kernel test robot
2026-03-18 14:10 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox