All of lore.kernel.org
 help / color / mirror / Atom feed
From: "dan carpenter" <error27@email.com>
To: linux-kernel@vger.kernel.org
Cc: smatch-kbugs@lists.sf.net, kernel-janitor-discuss@lists.sf.net
Subject: [LIST] large local declarations
Date: Thu, 21 Nov 2002 16:54:58 -0500	[thread overview]
Message-ID: <20021121215458.8534.qmail@email.com> (raw)

I have a smatch script (smatch.sf.net) that finds the the size of local variables.  I created an allyesconfig with 2.5.48 and tested it.  These were the functions that declared local datas with size of 5 digits or more (in bits).  Some of them should probably be changed to declare a pointer then use kmalloc() and free().

if (foo) {
        int frob[HUGE_NUM];
        ...
} else {
        int bar[HUGE_NUM];
        ...
}
This would not count against you twice, since the script takes code paths into consideration.

The function with the largest variable is riocontrol().  It is used deliberately for some weird hardware.  According to the comment, "it's hardware like this that really gets on [the author's] tits."

regards,
dan carpenter

size     file lineno function
16768	 drivers/atm/iphase.c 2874 ia_ioctl
11104	 drivers/block/cpqarray.c 1090 ida_ioctl
21248	 drivers/cdrom/optcd.c 1623 cdromread
524736	 drivers/char/rio/rioctrl.c 1784 riocontrol
15968	 drivers/ide/ide.c 1893 ide_unregister
16448	 drivers/isdn/i4l/isdn_common.c 1271 isdn_statstr
12320	 drivers/media/video/meye.c 400 jpeg_quantisation_tables
16552	 drivers/media/video/w9966.c 911 w9966_v4l_read
16584	 drivers/message/i2o/i2o_proc.c 1094 i2o_proc_read_groups
16640	 drivers/message/i2o/i2o_proc.c 2295 i2o_proc_read_lan_mcast_addr
16640	 drivers/message/i2o/i2o_proc.c 2525 i2o_proc_read_lan_alt_addr
23072	 drivers/message/i2o/i2o_proc.c 889 i2o_proc_read_ddm_table
12224	 drivers/mtd/chips/amd_flash.c 751 amd_flash_probe
35744	 drivers/net/e100/e100_main.c 2812 e100_load_microcode
16496	 drivers/net/wireless/airo.c 5949 readrids
16640	 drivers/net/wireless/airo.c 6041 writerids
32896	 drivers/scsi/53c700.c 1752 NCR_700_proc_directory_info
11744	 drivers/scsi/aic7xxx_old.c 11156 aic7xxx_print_card
16824	 drivers/scsi/cpqfcTScontrol.c 1630 CpqTsProcessIMQEntry
16496	 drivers/scsi/cpqfcTScontrol.c 648 PeekIMQEntry
24800	 drivers/scsi/qlogicfc.c 937 isp2x00_make_portdb
25808	 drivers/usb/media/ibmcam.c 3480 ibmcam_model3_setup_after_video_if
16280	 drivers/usb/media/ibmcam.c 638 ibmcam_parse_lines
16160	 drivers/usb/media/ibmcam.c 945 ibmcam_model3_parse_lines
11104	 fs/cifs/smbdes.c 270 dohash
33056	 fs/intermezzo/journal.c 1281 presto_copy_kml_tail
33344	 fs/intermezzo/journal.c 1633 presto_get_fileid
16512	 fs/nfsd/nfsctl.c 214 write_export
16512	 fs/nfsd/nfsctl.c 224 write_unexport
10336	 fs/xfs/xfs_da_btree.c 599 xfs_da_node_rebalance
27104	 fs/xfs/xfs_dir_leaf.c 763 xfs_dir_leaf_to_node
12480	 fs/xfs/xfs_fsops.c 381 xfs_growfs_data_private
11552	 lib/inflate.c 488 huft_build
10560	 lib/inflate.c 906 inflate_dynamic
10336	 net/wanrouter/wanmain.c 776 device_new_if
11360	 sound/core/oss/pcm_oss.c 453 snd_pcm_oss_change_params
16864	 sound/pci/emu10k1/emufx.c 2283 snd_emu10k1_fx8010_ioctl


The script used to generate the data:
#!/usr/bin/perl -w

use smatch;
my $max = 0;

sub merge_rules($$){
    my $one = shift;
    my $two = shift;
    if (int($one) > int($two)){
	return $one;
    }else{
	return $two;
    }
}

while ($data = get_data()){

    if ($data =~ /func_impl/){
	$max = 0;
    }
    if ($data =~ /end_func/){
	print get_filename(), " ", get_lineno(), " ", get_cur_func(), " $max\n";
    }

    if ($data =~ /decl_size\(integer_cst\((\d+)\)\)/){
	set_state("total", get_state("total")+$1);
	if ($max < get_state("total")){
	    $max = get_state("total");
	}
    }
}


-- 
_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup


             reply	other threads:[~2002-11-21 21:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-21 21:54 dan carpenter [this message]
2002-11-22  6:25 ` [LIST] large local declarations Roland Dreier
2002-11-22  6:49   ` Randy.Dunlap
2002-11-22  7:04 ` SL Baur
  -- strict thread matches above, loose matches on Subject: below --
2002-11-22  7:41 dan carpenter

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=20021121215458.8534.qmail@email.com \
    --to=error27@email.com \
    --cc=kernel-janitor-discuss@lists.sf.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=smatch-kbugs@lists.sf.net \
    /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.