Re: [linux-next:master 5836/7122] fs/dlm/lockspace.c:566 new_lockspace() warn: missing error code 'error'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Apr 22, 2024 at 9:31 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   a35e92ef04c07bd473404b9b73d489aea19a60a8
> commit: 6c648035cbe75d78836f6d7d2fdd9d996048a66b [5836/7122] dlm: switch to use rhashtable for rsbs
> config: i386-randconfig-141-20240420 (https://download.01.org/0day-ci/archive/20240420/202404200536.jGi6052v-lkp@xxxxxxxxx/config)
> compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
>
> 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@xxxxxxxxx>
> | Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> | Closes: https://lore.kernel.org/r/202404200536.jGi6052v-lkp@xxxxxxxxx/
>
> New smatch warnings:
> fs/dlm/lockspace.c:566 new_lockspace() warn: missing error code 'error'
>
> vim +/error +566 fs/dlm/lockspace.c
>
> 60f98d1839376d David Teigland       2011-11-02  407  static int new_lockspace(const char *name, const char *cluster,
> 60f98d1839376d David Teigland       2011-11-02  408                      uint32_t flags, int lvblen,
> 60f98d1839376d David Teigland       2011-11-02  409                      const struct dlm_lockspace_ops *ops, void *ops_arg,
> 60f98d1839376d David Teigland       2011-11-02  410                      int *ops_result, dlm_lockspace_t **lockspace)
> e7fd41792fc0ee David Teigland       2006-01-18  411  {
> e7fd41792fc0ee David Teigland       2006-01-18  412     struct dlm_ls *ls;
> 79d72b54483bf8 David Teigland       2007-05-18  413     int do_unreg = 0;
> 60f98d1839376d David Teigland       2011-11-02  414     int namelen = strlen(name);
> 6c648035cbe75d Alexander Aring      2024-04-15  415     int i, error;
> e7fd41792fc0ee David Teigland       2006-01-18  416
> 3f0806d2596de0 Tycho Andersen       2018-11-02  417     if (namelen > DLM_LOCKSPACE_LEN || namelen == 0)
> e7fd41792fc0ee David Teigland       2006-01-18  418             return -EINVAL;
> e7fd41792fc0ee David Teigland       2006-01-18  419
> b5c9d37c7f6051 Alexander Aring      2022-08-15  420     if (lvblen % 8)
> e7fd41792fc0ee David Teigland       2006-01-18  421             return -EINVAL;
> e7fd41792fc0ee David Teigland       2006-01-18  422
> e7fd41792fc0ee David Teigland       2006-01-18  423     if (!try_module_get(THIS_MODULE))
> e7fd41792fc0ee David Teigland       2006-01-18  424             return -EINVAL;
> e7fd41792fc0ee David Teigland       2006-01-18  425
> dc68c7ed362a00 David Teigland       2008-08-18  426     if (!dlm_user_daemon_available()) {
> 60f98d1839376d David Teigland       2011-11-02  427             log_print("dlm user daemon not available");
> 60f98d1839376d David Teigland       2011-11-02  428             error = -EUNATCH;
> 60f98d1839376d David Teigland       2011-11-02  429             goto out;
> 60f98d1839376d David Teigland       2011-11-02  430     }
> 60f98d1839376d David Teigland       2011-11-02  431
> 60f98d1839376d David Teigland       2011-11-02  432     if (ops && ops_result) {
> 60f98d1839376d David Teigland       2011-11-02  433             if (!dlm_config.ci_recover_callbacks)
> 60f98d1839376d David Teigland       2011-11-02  434                     *ops_result = -EOPNOTSUPP;
> 60f98d1839376d David Teigland       2011-11-02  435             else
> 60f98d1839376d David Teigland       2011-11-02  436                     *ops_result = 0;
> 60f98d1839376d David Teigland       2011-11-02  437     }
> 60f98d1839376d David Teigland       2011-11-02  438
> 3b0e761ba83cb0 Zhu Lingshan         2017-07-11  439     if (!cluster)
> 3b0e761ba83cb0 Zhu Lingshan         2017-07-11  440             log_print("dlm cluster name '%s' is being used without an application provided cluster name",
> 3b0e761ba83cb0 Zhu Lingshan         2017-07-11  441                       dlm_config.ci_cluster_name);
> 3b0e761ba83cb0 Zhu Lingshan         2017-07-11  442
> 60f98d1839376d David Teigland       2011-11-02  443     if (dlm_config.ci_recover_callbacks && cluster &&
> 60f98d1839376d David Teigland       2011-11-02  444         strncmp(cluster, dlm_config.ci_cluster_name, DLM_LOCKSPACE_LEN)) {
> 8e1743748b7e96 Gang He              2017-05-18  445             log_print("dlm cluster name '%s' does not match "
> 8e1743748b7e96 Gang He              2017-05-18  446                       "the application cluster name '%s'",
> 60f98d1839376d David Teigland       2011-11-02  447                       dlm_config.ci_cluster_name, cluster);
> 60f98d1839376d David Teigland       2011-11-02  448             error = -EBADR;
> 60f98d1839376d David Teigland       2011-11-02  449             goto out;
> dc68c7ed362a00 David Teigland       2008-08-18  450     }
> dc68c7ed362a00 David Teigland       2008-08-18  451
> 0f8e0d9a317406 David Teigland       2008-08-06  452     error = 0;
> 0f8e0d9a317406 David Teigland       2008-08-06  453
> 578acf9a87a875 Alexander Aring      2024-04-02  454     spin_lock_bh(&lslist_lock);
> 0f8e0d9a317406 David Teigland       2008-08-06  455     list_for_each_entry(ls, &lslist, ls_list) {
> 0f8e0d9a317406 David Teigland       2008-08-06  456             WARN_ON(ls->ls_create_count <= 0);
> 0f8e0d9a317406 David Teigland       2008-08-06  457             if (ls->ls_namelen != namelen)
> 0f8e0d9a317406 David Teigland       2008-08-06  458                     continue;
> 0f8e0d9a317406 David Teigland       2008-08-06  459             if (memcmp(ls->ls_name, name, namelen))
> 0f8e0d9a317406 David Teigland       2008-08-06  460                     continue;
> 0f8e0d9a317406 David Teigland       2008-08-06  461             if (flags & DLM_LSFL_NEWEXCL) {
> 0f8e0d9a317406 David Teigland       2008-08-06  462                     error = -EEXIST;
> 0f8e0d9a317406 David Teigland       2008-08-06  463                     break;
> 0f8e0d9a317406 David Teigland       2008-08-06  464             }
> 0f8e0d9a317406 David Teigland       2008-08-06  465             ls->ls_create_count++;
> 8511a2728ab82c David Teigland       2009-04-08  466             *lockspace = ls;
> 8511a2728ab82c David Teigland       2009-04-08  467             error = 1;
> 0f8e0d9a317406 David Teigland       2008-08-06  468             break;
> e7fd41792fc0ee David Teigland       2006-01-18  469     }
> 578acf9a87a875 Alexander Aring      2024-04-02  470     spin_unlock_bh(&lslist_lock);
> 0f8e0d9a317406 David Teigland       2008-08-06  471
> 0f8e0d9a317406 David Teigland       2008-08-06  472     if (error)
> 8511a2728ab82c David Teigland       2009-04-08  473             goto out;
> 0f8e0d9a317406 David Teigland       2008-08-06  474
> 0f8e0d9a317406 David Teigland       2008-08-06  475     error = -ENOMEM;
> e7fd41792fc0ee David Teigland       2006-01-18  476
> d96d0f9617793b Paulo Miguel Almeida 2022-10-12  477     ls = kzalloc(sizeof(*ls), GFP_NOFS);
> e7fd41792fc0ee David Teigland       2006-01-18  478     if (!ls)
> e7fd41792fc0ee David Teigland       2006-01-18  479             goto out;
> e7fd41792fc0ee David Teigland       2006-01-18  480     memcpy(ls->ls_name, name, namelen);
> e7fd41792fc0ee David Teigland       2006-01-18  481     ls->ls_namelen = namelen;
> e7fd41792fc0ee David Teigland       2006-01-18  482     ls->ls_lvblen = lvblen;
> 3cb5977c5214c2 Alexander Aring      2021-11-02  483     atomic_set(&ls->ls_count, 0);
> 3cb5977c5214c2 Alexander Aring      2021-11-02  484     init_waitqueue_head(&ls->ls_count_wait);
> e7fd41792fc0ee David Teigland       2006-01-18  485     ls->ls_flags = 0;
> c1dcf65ffc5796 David Teigland       2008-08-18  486     ls->ls_scan_time = jiffies;
> e7fd41792fc0ee David Teigland       2006-01-18  487
> 60f98d1839376d David Teigland       2011-11-02  488     if (ops && dlm_config.ci_recover_callbacks) {
> 60f98d1839376d David Teigland       2011-11-02  489             ls->ls_ops = ops;
> 60f98d1839376d David Teigland       2011-11-02  490             ls->ls_ops_arg = ops_arg;
> 60f98d1839376d David Teigland       2011-11-02  491     }
> 60f98d1839376d David Teigland       2011-11-02  492
> 6b0afc0cc3e9a9 Alexander Aring      2022-06-22  493     /* ls_exflags are forced to match among nodes, and we don't
> 6b0afc0cc3e9a9 Alexander Aring      2022-06-22  494      * need to require all nodes to have some flags set
> 6b0afc0cc3e9a9 Alexander Aring      2022-06-22  495      */
> 6b0afc0cc3e9a9 Alexander Aring      2022-06-22  496     ls->ls_exflags = (flags & ~(DLM_LSFL_FS | DLM_LSFL_NEWEXCL));
> fad59c1390045b David Teigland       2007-06-11  497
> 93a693d19d2a4a Alexander Aring      2024-04-15  498     INIT_LIST_HEAD(&ls->ls_toss);
> 93a693d19d2a4a Alexander Aring      2024-04-15  499     INIT_LIST_HEAD(&ls->ls_keep);
> dcdaad05ca1515 Alexander Aring      2024-04-15  500     spin_lock_init(&ls->ls_rsbtbl_lock);
> e7fd41792fc0ee David Teigland       2006-01-18  501
> 6c648035cbe75d Alexander Aring      2024-04-15  502     error = rhashtable_init(&ls->ls_rsbtbl, &dlm_rhash_rsb_params);
> 6c648035cbe75d Alexander Aring      2024-04-15  503     if (error)
> e7fd41792fc0ee David Teigland       2006-01-18  504             goto out_lsfree;
> e7fd41792fc0ee David Teigland       2006-01-18  505
> 05c32f47bfae74 David Teigland       2012-06-14  506     for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) {
> 05c32f47bfae74 David Teigland       2012-06-14  507             ls->ls_remove_names[i] = kzalloc(DLM_RESNAME_MAXLEN+1,
> 05c32f47bfae74 David Teigland       2012-06-14  508                                              GFP_KERNEL);
> 05c32f47bfae74 David Teigland       2012-06-14  509             if (!ls->ls_remove_names[i])
> 05c32f47bfae74 David Teigland       2012-06-14  510                     goto out_rsbtbl;
>                                                                         ^^^^^^^^^^^^^^^
> No error code.

yes, later patch removes that allocation.

> 05c32f47bfae74 David Teigland       2012-06-14  511     }
> 05c32f47bfae74 David Teigland       2012-06-14  512
> 3d6aa675fff9ee David Teigland       2011-07-06  513     idr_init(&ls->ls_lkbidr);
> 3d6aa675fff9ee David Teigland       2011-07-06  514     spin_lock_init(&ls->ls_lkbidr_spin);
> e7fd41792fc0ee David Teigland       2006-01-18  515
> e7fd41792fc0ee David Teigland       2006-01-18  516     INIT_LIST_HEAD(&ls->ls_waiters);
> 097691dbadcdca Alexander Aring      2024-04-02  517     spin_lock_init(&ls->ls_waiters_lock);
> ef0c2bb05f40f9 David Teigland       2007-03-28  518     INIT_LIST_HEAD(&ls->ls_orphans);
> ef0c2bb05f40f9 David Teigland       2007-03-28  519     mutex_init(&ls->ls_orphans_mutex);
> e7fd41792fc0ee David Teigland       2006-01-18  520
> 3881ac04ebf942 David Teigland       2011-07-07  521     INIT_LIST_HEAD(&ls->ls_new_rsb);
> 3881ac04ebf942 David Teigland       2011-07-07  522     spin_lock_init(&ls->ls_new_rsb_spin);
> 3881ac04ebf942 David Teigland       2011-07-07  523
> e7fd41792fc0ee David Teigland       2006-01-18  524     INIT_LIST_HEAD(&ls->ls_nodes);
> e7fd41792fc0ee David Teigland       2006-01-18  525     INIT_LIST_HEAD(&ls->ls_nodes_gone);
> e7fd41792fc0ee David Teigland       2006-01-18  526     ls->ls_num_nodes = 0;
> e7fd41792fc0ee David Teigland       2006-01-18  527     ls->ls_low_nodeid = 0;
> e7fd41792fc0ee David Teigland       2006-01-18  528     ls->ls_total_weight = 0;
> e7fd41792fc0ee David Teigland       2006-01-18  529     ls->ls_node_array = NULL;
> e7fd41792fc0ee David Teigland       2006-01-18  530
> a7e7ffacad7b9b Alexander Aring      2023-03-06  531     memset(&ls->ls_local_rsb, 0, sizeof(struct dlm_rsb));
> a7e7ffacad7b9b Alexander Aring      2023-03-06  532     ls->ls_local_rsb.res_ls = ls;
> e7fd41792fc0ee David Teigland       2006-01-18  533
> 5de6319b183930 David Teigland       2006-07-25  534     ls->ls_debug_rsb_dentry = NULL;
> 5de6319b183930 David Teigland       2006-07-25  535     ls->ls_debug_waiters_dentry = NULL;
> e7fd41792fc0ee David Teigland       2006-01-18  536
> e7fd41792fc0ee David Teigland       2006-01-18  537     init_waitqueue_head(&ls->ls_uevent_wait);
> e7fd41792fc0ee David Teigland       2006-01-18  538     ls->ls_uevent_result = 0;
> 682bb91b6ba829 Alexander Aring      2022-06-22  539     init_completion(&ls->ls_recovery_done);
> 682bb91b6ba829 Alexander Aring      2022-06-22  540     ls->ls_recovery_result = -1;
> e7fd41792fc0ee David Teigland       2006-01-18  541
> a4c0352bb1094c Alexander Aring      2022-10-27  542     spin_lock_init(&ls->ls_cb_lock);
> 23e8e1aaacb10d David Teigland       2011-04-05  543     INIT_LIST_HEAD(&ls->ls_cb_delay);
> 23e8e1aaacb10d David Teigland       2011-04-05  544
> e7fd41792fc0ee David Teigland       2006-01-18  545     ls->ls_recoverd_task = NULL;
> 901359256b2666 David Teigland       2006-01-20  546     mutex_init(&ls->ls_recoverd_active);
> e7fd41792fc0ee David Teigland       2006-01-18  547     spin_lock_init(&ls->ls_recover_lock);
> 98f176fb32f337 David Teigland       2006-11-27  548     spin_lock_init(&ls->ls_rcom_spin);
> 98f176fb32f337 David Teigland       2006-11-27  549     get_random_bytes(&ls->ls_rcom_seq, sizeof(uint64_t));
> e7fd41792fc0ee David Teigland       2006-01-18  550     ls->ls_recover_status = 0;
> 317dd6ba6ccaa5 Alexander Aring      2023-01-12  551     ls->ls_recover_seq = get_random_u64();
> e7fd41792fc0ee David Teigland       2006-01-18  552     ls->ls_recover_args = NULL;
> e7fd41792fc0ee David Teigland       2006-01-18  553     init_rwsem(&ls->ls_in_recovery);
> d52c9b8fefa3ed Alexander Aring      2024-04-02  554     rwlock_init(&ls->ls_recv_active);
> e7fd41792fc0ee David Teigland       2006-01-18  555     INIT_LIST_HEAD(&ls->ls_requestqueue);
> c288745f1d4a2e Alexander Aring      2024-04-02  556     rwlock_init(&ls->ls_requestqueue_lock);
> 296d9d1e989083 Alexander Aring      2022-08-15  557     spin_lock_init(&ls->ls_clear_proc_locks);
> e7fd41792fc0ee David Teigland       2006-01-18  558
> 489d8e559c6596 Alexander Aring      2021-05-21  559     /* Due backwards compatibility with 3.1 we need to use maximum
> 489d8e559c6596 Alexander Aring      2021-05-21  560      * possible dlm message size to be sure the message will fit and
> 489d8e559c6596 Alexander Aring      2021-05-21  561      * not having out of bounds issues. However on sending side 3.2
> 489d8e559c6596 Alexander Aring      2021-05-21  562      * might send less.
> 489d8e559c6596 Alexander Aring      2021-05-21  563      */
> d10a0b88751a09 Alexander Aring      2021-06-02  564     ls->ls_recover_buf = kmalloc(DLM_MAX_SOCKET_BUFSIZE, GFP_NOFS);
> e7fd41792fc0ee David Teigland       2006-01-18  565     if (!ls->ls_recover_buf)
> 05c32f47bfae74 David Teigland       2012-06-14 @566             goto out_lkbidr;
>
> Here too.
>

This is still in dlm/next and needs an error code, yes.

Thanks.

- Alex






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux