The patch titled drivers/media/video/videobuf-dma-sg.c: avoid clearing memory twice has been added to the -mm tree. Its filename is drivers-media-video-videobuf-dma-sgc-avoid-clearing-memory-twice.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: drivers/media/video/videobuf-dma-sg.c: avoid clearing memory twice From: Christophe Jaillet <jaillet.christophe@xxxxxxxxxx> 1) Remove a useless initialisation of 'i' 2) Avoid clearing the memory allocated twice (once in 'kcalloc', once in 'sg_init_table') 3) Remove a test that can never trigger. The function returns NULL in such a case, so we know that at this point 'pages[0]' != NULL Signed-off-by: Christophe Jaillet <jaillet.christophe@xxxxxxxxxx> Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/media/video/videobuf-dma-sg.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff -puN drivers/media/video/videobuf-dma-sg.c~drivers-media-video-videobuf-dma-sgc-avoid-clearing-memory-twice drivers/media/video/videobuf-dma-sg.c --- a/drivers/media/video/videobuf-dma-sg.c~drivers-media-video-videobuf-dma-sgc-avoid-clearing-memory-twice +++ a/drivers/media/video/videobuf-dma-sg.c @@ -80,17 +80,15 @@ struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) { struct scatterlist *sglist; - int i = 0; + int i; if (NULL == pages[0]) return NULL; - sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL); + sglist = kmalloc(nr_pages * sizeof(*sglist), GFP_KERNEL); if (NULL == sglist) return NULL; sg_init_table(sglist, nr_pages); - if (NULL == pages[0]) - goto nopage; if (PageHighMem(pages[0])) /* DMA to highmem pages might not work */ goto highmem; _ Patches currently in -mm which might be from jaillet.christophe@xxxxxxxxxx are drivers-media-video-videobuf-dma-sgc-avoid-clearing-memory-twice.patch drivers-block-pktcdvdc-avoid-useless-memset.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html