From srikanth.krishnamachary at wipro.com Tue Feb 1 23:21:31 2005 From: srikanth.krishnamachary at wipro.com (srikanth.krishnamachary@wipro.com) Date: Wed Mar 22 17:10:51 2006 Subject: [splint-discuss] Using splint for bounds when the array size is to be found during run time. Message-ID: <6719973BAEBAF744AEAD2B6F0768B3861614AB@hyd-mdp-msg.wipro.com> Hi all, I using splint for the first time. My basic purpose of using splint is to capture bounds errors and memory leaks. In my sample code, I have two variables namely num_of_interfaces & interface_names. interface_names is an pointer to interface name whose size is known at run time once, detect_num_of_interfaces() is run. As a result, interface_names[i] = Defined Result (if i >=0 && i < num_of_interface) else, Undefined. I would therefore like to incorprorate the same into the interface.h so that I need not put the same check as part of the "REQUIRES" clause in each function, that will possibly be using this variable. Has someone done anything like this before. If so, please let me know how to go about it. File: interface.h ================== [root@laxeri3d7 tmp]# cat interfaces.h int num_of_interfaces; typedef char * string; string *interface_names; File Interface.c ================= [root@laxeri3d7 tmp]# cat interfaces.c #include "./interfaces.h" char sample_device_name[]="Sample Device"; int detect_num_of_interfaces(void) { /* Some Hardware specific function. It could for example be an pci_probe that'll probe for each device attached to the pci bus */ return 10; /* some value */ } string detect_interface_name(int dev_id) { /* Will return the device name. We can just say that the device_id + Vendor id will be the interface name for now, let us say that all device names are "Sample Device" */ return sample_device_name; } void configure_interfaces() { int i; num_of_interfaces=detect_num_of_interfaces(); interface_names = (string *)malloc(sizeof(string) * num_of_interfaces); for (i = 0; i < num_of_interfaces; i++) interface_names[i] = detect_interface_name(i); } int print_interface_names() { int i; for(i=0; i= i @ interfaces.c:36:63 needed to satisfy precondition: requires maxRead(interface_names @ interfaces.c:36:47) >= i @ interfaces.c:36:63 A memory read references memory beyond the allocated storage. (Use -boundsread to inhibit warning) Finished checking --- 1 code warning [root@laxeri3d7 tmp]# Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately and destroy all copies of this message and any attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050202/12e4492a/attachment.htm From minal.sharma at st.com Wed Feb 2 02:53:13 2005 From: minal.sharma at st.com (Minal SHARMA) Date: Wed Mar 22 17:10:51 2006 Subject: [splint-discuss] Need Splint Configuration guide for embeeded software Message-ID: <000901c508fc$3ff886c0$c60ab40a@dlh.st.com> Hi all, I am trying to configure the Splint first time for Linux and Embedded environment. But getting several errors like:undefined variable, function doesn't return value , variable defined but not used. But on checking manually this is not the case. I have bypassed the ~/.splintrc by making my own configuration file in which I 've set the flags and files to include using - I option. But it is not recognizing the variables defined inside the header file and giving error in each line. On adding the +accessfile flag the case is same. The version I am using is 3.0.1.7. Can any one know how to configure it for Linux Env. From minal.sharma at st.com Wed Feb 23 07:00:24 2005 From: minal.sharma at st.com (Minal SHARMA) Date: Wed Mar 22 17:10:51 2006 Subject: [splint-discuss] Using Splint on Linux kernel modules Message-ID: <007801c5199f$42c1aa90$c60ab40a@dlh.st.com> Hi I am using splint for the first time for Linux kernel modules. I've read this but unable to understand which makefile is this? i.e which makefile to change? I am getting the parse error in /include/linux/proc_fs. How to resolve it? Thnx & Regds Minal From brian.quinlan at iolfree.ie Wed Feb 23 08:49:46 2005 From: brian.quinlan at iolfree.ie (Brian Quinlan) Date: Wed Mar 22 17:10:51 2006 Subject: [splint-discuss] Using Splint on Linux kernel modules In-Reply-To: <007801c5199f$42c1aa90$c60ab40a@dlh.st.com> References: <007801c5199f$42c1aa90$c60ab40a@dlh.st.com> Message-ID: <1109166584.1152.105.camel@dub1-odcl4> Hi, I assume you are referring to the makefile in this post: http://www.splint.org/pipermail/splint-discuss/2005-January/000528.html This makefile is based on the makefile that we used to build a device specific Linux kernel module. The device specific portions have been removed because they aren't helpful to most splint users. You'll need to update the makefile to define the SPLINT, SRCS and INC_FLAGS variable to be something that's specific to your environment. If you're not using a makefile, then it should be possible to use the info in our makefile to construct the command line to invoke splint. The post referenced above contains 90% of the solution to your problem. You might also need to add to SplintLinuxKernelHelper.h if your code has new parse problems that our code doesn't have. Bye, Brian Quinlan Duolog Technologies On Wed, 2005-02-23 at 12:00, Minal SHARMA wrote: > Hi > > I am using splint for the first time for Linux kernel modules. > I've read this but unable to understand which makefile is this? > i.e which makefile to change? > > I am getting the parse error in /include/linux/proc_fs. > How to resolve it? > > Thnx & Regds > Minal > > _______________________________________________ > splint-discuss mailing list > splint-discuss@cs.virginia.edu > http://www.splint.org/mailman/listinfo/splint-discuss From minal.sharma at st.com Thu Feb 24 06:50:35 2005 From: minal.sharma at st.com (Minal SHARMA) Date: Wed Mar 22 17:10:51 2006 Subject: [splint-discuss] Using Splint on Linux kernel modules In-Reply-To: <1109166584.1152.105.camel@dub1-odcl4> Message-ID: <008b01c51a67$0d6d7cc0$c60ab40a@dlh.st.com> Hi Brian Is thr any method by which we can supress the warnings of a particular file. I was trying to check the code of my module and it is giving a lots of warning in the files that are comming from Montavista basic code. So is thr any flag by which we can modify our splintrc file so that it does not give the warnings of Montavista basic code. Also we have some defined types that is included in one particular file say types.h and this files has been included in our file say myfile.c. We have included this (types.h)file in our splintrc by -I flag but the splint doesn't recognise these types defined by us and gives a lots of warnings of incompatible types errors. Is thr any way to suppress these warnings. We have tried to suppress by using -D option but the problem is this list is very large. Thnx For your help. Minal -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Brian Quinlan Sent: Wednesday, February 23, 2005 7:20 PM To: Discussions about the Splint annotation-assisted static analysis project Subject: Re: [splint-discuss] Using Splint on Linux kernel modules Hi, I assume you are referring to the makefile in this post: http://www.splint.org/pipermail/splint-discuss/2005-January/000528.html This makefile is based on the makefile that we used to build a device specific Linux kernel module. The device specific portions have been removed because they aren't helpful to most splint users. You'll need to update the makefile to define the SPLINT, SRCS and INC_FLAGS variable to be something that's specific to your environment. If you're not using a makefile, then it should be possible to use the info in our makefile to construct the command line to invoke splint. The post referenced above contains 90% of the solution to your problem. You might also need to add to SplintLinuxKernelHelper.h if your code has new parse problems that our code doesn't have. Bye, Brian Quinlan Duolog Technologies On Wed, 2005-02-23 at 12:00, Minal SHARMA wrote: > Hi > > I am using splint for the first time for Linux kernel modules. I've > read this but unable to understand which makefile is this? i.e which > makefile to change? > > I am getting the parse error in /include/linux/proc_fs. > How to resolve it? > > Thnx & Regds > Minal > > _______________________________________________ > splint-discuss mailing list > splint-discuss@cs.virginia.edu > http://www.splint.org/mailman/listinfo/splint-discuss _______________________________________________ splint-discuss mailing list splint-discuss@cs.virginia.edu http://www.splint.org/mailman/listinfo/splint-discuss From stephane.martin at ca.kontron.com Thu Feb 24 08:11:52 2005 From: stephane.martin at ca.kontron.com (=?iso-8859-1?Q?=22Martin=2C_St=E9phane=22?=) Date: Wed Mar 22 17:10:51 2006 Subject: [splint-discuss] Using Splint on Linux kernel modules Message-ID: <5009AD9521A8D41198EE00805F85F18F0631427F@sembo111.teknor.com> It might not works well for kernel module but we succesfulliy use a splintfool.h file in our Linux Deamon where system call was "prototyped" in a way that Splint correctly analyze the code. All location where the splintfool.h was inserted is surround with the S_SPLINT_S define like this: #ifdef S_SPLINT_S /* fool splint for system declaration */ #include "splintfool.h" #endif and this way since S_SPLINT_S does't exist for the compiler it does not interfear with the compiler. ------------------------------------------------------------- Stephane Martin, ing. Kontron Canada Low Level Software Engineer 616 Cure-Boivin Tel (450) 437-4661 ext: 2349 Boisbriand, Quebec Fax (450) 437-8053 Canada, J7G 2A7 mailto:stephane.martin@ca.kontron.com http://www.kontron.com -----Message d'origine----- De : Minal SHARMA [mailto:minal.sharma@st.com] Envoy? : 24 f?vrier, 2005 06:51 ? : 'Discussions about the Splint annotation-assisted static analysis project' Objet : RE: [splint-discuss] Using Splint on Linux kernel modules Hi Brian Is thr any method by which we can supress the warnings of a particular file. I was trying to check the code of my module and it is giving a lots of warning in the files that are comming from Montavista basic code. So is thr any flag by which we can modify our splintrc file so that it does not give the warnings of Montavista basic code. Also we have some defined types that is included in one particular file say types.h and this files has been included in our file say myfile.c. We have included this (types.h)file in our splintrc by -I flag but the splint doesn't recognise these types defined by us and gives a lots of warnings of incompatible types errors. Is thr any way to suppress these warnings. We have tried to suppress by using -D option but the problem is this list is very large. Thnx For your help. Minal -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Brian Quinlan Sent: Wednesday, February 23, 2005 7:20 PM To: Discussions about the Splint annotation-assisted static analysis project Subject: Re: [splint-discuss] Using Splint on Linux kernel modules Hi, I assume you are referring to the makefile in this post: http://www.splint.org/pipermail/splint-discuss/2005-January/000528.html This makefile is based on the makefile that we used to build a device specific Linux kernel module. The device specific portions have been removed because they aren't helpful to most splint users. You'll need to update the makefile to define the SPLINT, SRCS and INC_FLAGS variable to be something that's specific to your environment. If you're not using a makefile, then it should be possible to use the info in our makefile to construct the command line to invoke splint. The post referenced above contains 90% of the solution to your problem. You might also need to add to SplintLinuxKernelHelper.h if your code has new parse problems that our code doesn't have. Bye, Brian Quinlan Duolog Technologies On Wed, 2005-02-23 at 12:00, Minal SHARMA wrote: > Hi > > I am using splint for the first time for Linux kernel modules. I've > read this but unable to understand which makefile is this? i.e which > makefile to change? > > I am getting the parse error in /include/linux/proc_fs. > How to resolve it? > > Thnx & Regds > Minal > > _______________________________________________ > splint-discuss mailing list > splint-discuss@cs.virginia.edu > http://www.splint.org/mailman/listinfo/splint-discuss _______________________________________________ splint-discuss mailing list splint-discuss@cs.virginia.edu http://www.splint.org/mailman/listinfo/splint-discuss _______________________________________________ splint-discuss mailing list splint-discuss@cs.virginia.edu http://www.splint.org/mailman/listinfo/splint-discuss