All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yunseong Kim <yskelg@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	oe-kbuild@lists.linux.dev,
	Harald Freudenberger <freude@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	shjy180909@gmail.com, linux-s390@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] s390/zcrypt: optimize memory allocation in online_show()
Date: Tue, 9 Jul 2024 07:51:51 +0900	[thread overview]
Message-ID: <56d2ff54-3c3a-4fb3-8006-72e183faa8bc@gmail.com> (raw)
In-Reply-To: <ebe44c83-19bd-43e9-8999-99e3ccc7b417@suswa.mountain>

Hi Dan,

On 7/9/24 12:55 오전, Dan Carpenter wrote:
> Hi,
> 
> kernel test robot noticed the following build warnings:
> 
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/yskelg-gmail-com/s390-zcrypt-optimize-memory-allocation-in-online_show/20240626-071004
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
> patch link:    https://lore.kernel.org/r/20240623120147.35554-3-yskelg%40gmail.com
> patch subject: [PATCH] s390/zcrypt: optimize memory allocation in online_show()
> config: s390-randconfig-r081-20240707 (https://download.01.org/0day-ci/archive/20240707/202407071714.4AUEoeUD-lkp@intel.com/config)
> compiler: s390-linux-gcc (GCC) 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@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202407071714.4AUEoeUD-lkp@intel.com/
> 
> smatch warnings:
> drivers/s390/crypto/zcrypt_card.c:103 online_store() warn: iterator used outside loop: 'zq'
> 
> vim +/zq +103 drivers/s390/crypto/zcrypt_card.c

Thank you for the review. I decided not to work on my patch anymore
after the review because my patch was problematic and not useful.

> df6f508c68dbc6 Harald Freudenberger 2021-04-13   90  	list_for_each_entry(zq, &zc->zqueues, list)
> 2ff6be56a27c2d Yunseong Kim         2024-06-23   91  		if (!!zq->online != !!online)
> df6f508c68dbc6 Harald Freudenberger 2021-04-13   92  			maxzqs++;
> df6f508c68dbc6 Harald Freudenberger 2021-04-13   93  	if (maxzqs > 0)
> 2ff6be56a27c2d Yunseong Kim         2024-06-23   94  		zq_uelist = kcalloc(maxzqs, sizeof(*zq_uelist), GFP_ATOMIC);
> e28d2af43614eb Ingo Tuchscherer     2016-08-25   95  	list_for_each_entry(zq, &zc->zqueues, list)
> df6f508c68dbc6 Harald Freudenberger 2021-04-13   96  		if (zcrypt_queue_force_online(zq, online))
> df6f508c68dbc6 Harald Freudenberger 2021-04-13   97  			if (zq_uelist) {
> df6f508c68dbc6 Harald Freudenberger 2021-04-13   98  				zcrypt_queue_get(zq);
> df6f508c68dbc6 Harald Freudenberger 2021-04-13   99  				zq_uelist[i++] = zq;
> df6f508c68dbc6 Harald Freudenberger 2021-04-13  100  			}
> e28d2af43614eb Ingo Tuchscherer     2016-08-25  101  	spin_unlock(&zcrypt_list_lock);
> 2ff6be56a27c2d Yunseong Kim         2024-06-23  102  	while (i--) {
> df6f508c68dbc6 Harald Freudenberger 2021-04-13 @103  		ap_send_online_uevent(&zq->queue->ap_dev, online);
>                                                                                        ^^
> zq is an invalid pointer here.  It's an offset off the list head.
> There used to be a "zq = zq_uelist[i];" before this function call but
> the patch deleted it.

My patch doesn't mean much to me at this point, but if it needed to be
fixed, I think it should have been.

> 2ff6be56a27c2d Yunseong Kim         2024-06-23  104  		zcrypt_queue_put(zq_uelist[i]);
> df6f508c68dbc6 Harald Freudenberger 2021-04-13  105  	}
> df6f508c68dbc6 Harald Freudenberger 2021-04-13  106  	kfree(zq_uelist);
> df6f508c68dbc6 Harald Freudenberger 2021-04-13  107  
> e28d2af43614eb Ingo Tuchscherer     2016-08-25  108  	return count;
> e28d2af43614eb Ingo Tuchscherer     2016-08-25  109  }


I've been doing some Linux kernel research on the IBM Cloud s390x VPC
and running syzkaller and Linux kernel tests tools to send out useful
patches. :)


Warm regards,

Yunseong kim

  reply	other threads:[~2024-07-08 22:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-23 12:01 [PATCH] s390/zcrypt: optimize memory allocation in online_show() yskelg
2024-06-23 16:01 ` Markus Elfring
2024-07-08 15:55 ` Dan Carpenter
2024-07-08 22:51   ` Yunseong Kim [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-07-07  9:29 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56d2ff54-3c3a-4fb3-8006-72e183faa8bc@gmail.com \
    --to=yskelg@gmail.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=dan.carpenter@linaro.org \
    --cc=freude@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=shjy180909@gmail.com \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.