public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Luca Falavigna <dktrkranz@gmail.com>
Cc: vamsi_krishna@in.ibm.com, prasanna@in.ibm.com,
	Nathan Lynch <nathanl@austin.ibm.com>,
	suparna@in.ibm.com, lkml <linux-kernel@vger.kernel.org>,
	Stephen Hemminger <shemminger@osdl.org>
Subject: Re: [PATCH] Kprobes /proc entry
Date: Mon, 17 Jan 2005 22:44:01 -0800	[thread overview]
Message-ID: <20050118064401.GA9529@kroah.com> (raw)
In-Reply-To: <41EBEE98.7090207@gmail.com>

On Mon, Jan 17, 2005 at 05:58:00PM +0100, Luca Falavigna wrote:
> +static ssize_t kprobes_read(struct file *file, char __user *buf,
> +			 size_t size, loff_t *off)
> +{
> +	int i;
> +	char *data = "";
> +	ssize_t len = 0;
> +	struct hlist_node *node;
> +	struct kprobe *k;
> +	
> +	spin_lock(&kprobe_lock);
> +	for(i = 0; i < KPROBE_TABLE_SIZE; i++) {
> +		hlist_for_each_entry(k, node, &kprobe_table[i], hlist) {
> +			if(k) {
> +				kprobes_list_info(k, data + len);
> +				len += strlen(data);
> +			}
> +		}
> +	}
> +	spin_unlock(&kprobe_lock);
> +	return simple_read_from_buffer(buf, size, off, data, len);

Am I missing where you allocate the space for the data to be put into?

Also, why not use the seqfile interface for this, to prevent overflowing
the read buffer?

thanks,

greg k-h

  reply	other threads:[~2005-01-18  6:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-10 16:25 [PATCH] Kprobes /proc entry Luca Falavigna
2005-01-10 18:14 ` Greg KH
2005-01-11 21:31   ` Nathan Lynch
2005-01-11 21:34     ` Greg KH
2005-01-12  0:09       ` Luca Falavigna
2005-01-12  6:35         ` Prasanna S Panchamukhi
2005-01-12  9:49           ` Prasanna S Panchamukhi
2005-01-13 23:20       ` Luca Falavigna
2005-01-13 23:34         ` Greg KH
2005-01-17 16:58           ` Luca Falavigna
2005-01-18  6:44             ` Greg KH [this message]
2005-01-20 14:13               ` Luca Falavigna
2005-01-14  0:22         ` Stephen Hemminger

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=20050118064401.GA9529@kroah.com \
    --to=greg@kroah.com \
    --cc=dktrkranz@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathanl@austin.ibm.com \
    --cc=prasanna@in.ibm.com \
    --cc=shemminger@osdl.org \
    --cc=suparna@in.ibm.com \
    --cc=vamsi_krishna@in.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox