Skip to contentSkip to conversation

[KJ]

KJ Stephen torri 6 participants 7 messages Jan 20, 2005 – Jul 31, 2006

Subsystems (5)
lore
Share & tools
lore
#1 lore raw

The function ext2_set_acl() declares a size_t called 'size' without setting it to an initial value. 'size' is not referred to again until you see:

if (acl) {
	// Email KJ comments: size IS initialized in this function
	// only if acl != NULL
	value = ext2_acl_to_disk(acl, &size);
	...
}

// Email KJ comments: If acl == NULL, size is passed to // this function uninitialized.
error = ext2_xattr_set(inode, name_index, "", value, size, 0);
...

The external function ext2_xattr_set() does not seem to use size in any meaningful way... but depending on some other parameters, it looks like 'size' could be read without being initialized.

Initializing 'size' to zero eliminates the compiler warning and the possibility of passing an uninitialized variable around.

*Note unlike previous patches, initializing 'size' in the function ext2_acl_to_disk() does not eliminate this particular warning. This is because of the conditional call to the function that initializes it.

fs/ext2/acl.c renamed from fs/ext2/acl.c~ +1 -1
@@ -220,7 +220,7 @@ ext2_set_acl(struct inode *inode, int ty
 	struct ext2_inode_info *ei = EXT2_I(inode);
 	int name_index;
 	void *value = NULL;
-	size_t size;
+	size_t size = 0;
 	int error;
 
 	if (S_ISLNK(inode->i_mode))

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Stephen torri

This one from my DMA_{32,64}BIT_MASK series did not seem to make it through to upstream.

Use the DMA_{32,64}BIT_MASK constants from dma-mapping.h when calling pci_set_dma_mask() or pci_set_consistent_dma_mask()
This patch includes dma-mapping.h explicitly because it caused errors on some architectures otherwise.
See http://marc.theaimsgroup.com/?t=108001993000001&r=1&w=2 for details

drivers/net/tg3.c +4 -3
diff -X dontdiff -urpN linux-2.6.14/drivers/net/tg3.c linux-2.6.14~dma_mask/drivers/net/tg3.c
@@ -37,6 +37,7 @@
 #include <linux/tcp.h>
 #include <linux/workqueue.h>
 #include <linux/prefetch.h>
+#include <linux/dma-mapping.h>
 
 #include <net/checksum.h>
 
@@ -10492,17 +10493,17 @@ static int __devinit tg3_init_one(struct
 	}
 
 	/* Configure DMA attributes. */
-	err = pci_set_dma_mask(pdev, 0xffffffffffffffffULL);
+	err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
 	if (!err) {
 		pci_using_dac = 1;
-		err = pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL);
+		err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
 		if (err < 0) {
 			printk(KERN_ERR PFX "Unable to obtain 64 bit DMA "
 			       "for consistent allocations\n");
 			goto err_out_free_res;
 		}
 	} else {
-		err = pci_set_dma_mask(pdev, 0xffffffffULL);
+		err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
 		if (err) {
 			printk(KERN_ERR PFX "No usable DMA configuration, "
 			       "aborting.\n");

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw
In reply to Stephen torri

From: Marcelo Feitoza Parisi

They deal with wrapping correctly and are nicer to read.

Signed-off-by Marcelo Feitoza Parisi
Signed-off-by Alexey Dobriyan
drivers/block/floppy.c +5 -4
Index: linux-kj/drivers/block/floppy.c
===================================================================
@@ -179,6 +179,7 @@ static int print_unex = 1;
 #include <linux/devfs_fs_kernel.h>
 #include <linux/platform_device.h>
 #include <linux/buffer_head.h>	/* for invalidate_buffers() */
+#include <linux/jiffies.h>
 
 /*
  * PS/2 floppies have much slower step rates than regular floppies.
@@ -736,7 +737,7 @@ static int disk_change(int drive)
 {
 	int fdc = FDC(drive);
 #ifdef FLOPPY_SANITY_CHECK
-	if (jiffies - UDRS->select_date < UDP->select_delay)
+	if (time_before(jiffies, UDRS->select_date + UDP->select_delay))
 		DPRINT("WARNING disk change called early\n");
 	if (!(FDCS->dor & (0x10 << UNIT(drive))) ||
 	    (FDCS->dor & 3) != UNIT(drive) || fdc != FDC(drive)) {
@@ -1064,7 +1065,7 @@ static int fd_wait_for_completion(unsign
 		return 1;
 	}
 
-	if ((signed)(jiffies - delay) < 0) {
+	if (time_before(jiffies, delay)) {
 		del_timer(&fd_timer);
 		fd_timer.function = function;
 		fd_timer.expires = delay;
@@ -1524,7 +1525,7 @@ static void setup_rw_floppy(void)
 		 * again just before spinup completion. Beware that
 		 * after scandrives, we must again wait for selection.
 		 */
-		if ((signed)(ready_date - jiffies) > DP->select_delay) {
+		if (time_after(ready_date, jiffies + DP->select_delay)) {
 			ready_date -= DP->select_delay;
 			function = (timeout_fn) floppy_start;
 		} else
@@ -3818,7 +3819,7 @@ static int check_floppy_change(struct ge
 	if (UTESTF(FD_DISK_CHANGED) || UTESTF(FD_VERIFY))
 		return 1;
 
-	if (UDP->checkfreq < (int)(jiffies - UDRS->last_checked)) {
+	if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
 		if (floppy_grab_irq_and_dma()) {
 			return 1;
 		}

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#4 lore raw
In reply to Stephen torri
Quoted 11 lines

drivers/char/watchdog/alim1535_wdt.c line 317

Quoted 11 lines
drivers/char/watchdog/alim1535_wdt.c +1 -1
@@ -312,7 +312,7 @@
  */
 
 static struct pci_device_id ali_pci_tbl[] = {
-	{ PCI_VENDOR_ID_AL, 0x1535, PCI_ANY_ID, PCI_ANY_ID,},
+	{ PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1535, PCI_ANY_ID, PCI_ANY_ID,},
 	{ 0, },
 };

Please use {PCI_DRIVER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1535)} for that.

Greets,
Henne

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#5 lore raw
In reply to Stephen torri
Quoted 11 lines

Review

Quoted 9 lines
(quoted diff) +4 -2
 		return -ENODEV;
+	} else {
+		pci_dev_put(pdev);
+	}
 
 	/* Check for the a 7101 PMU */
-	pdev = pci_find_device(PCI_VENDOR_ID_AL, 0x7101, NULL);
-	if(pdev = NULL)
+	pdev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL);

What if the previous _and_ this one succeed?

Since the original developer chose to just search for the 1535 and then overwrite the variable with the 7101 (that will be used), I thought I'd clear the memory of the first device before assigning the new device to it.

I guess I shouldn't have.

Will fix.

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#6 lore raw
In reply to Stephen torri
Quoted 13 lines · Henne
Quoted 11 lines

drivers/char/watchdog/alim1535_wdt.c line 317

Quoted 11 lines
drivers/char/watchdog/alim1535_wdt.c +1 -1
@@ -312,7 +312,7 @@
  */
 
 static struct pci_device_id ali_pci_tbl[] = {
-	{ PCI_VENDOR_ID_AL, 0x1535, PCI_ANY_ID, PCI_ANY_ID,},
+	{ PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1535, PCI_ANY_ID, PCI_ANY_ID,},
 	{ 0, },
 };

Please use {PCI_DRIVER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1535)} for that.

Quoted 2 lines

Greets,
Henne

Since I'm new here I just want to make sure..

You did mean PCI_DEVICE() ?

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors